integrating rsync with Rev

Sarah Reichelt sarah.reichelt at gmail.com
Fri May 16 07:54:30 EDT 2008


>> As an example, if I want to get a detailed directory listing in
>> Terminal, I use:   ls -la
>> In Rev, I would use:  put shell("ls -la") into fld "Listing"
>
>
> But what if I need to look into a locked directory, one that in terminal I'd
> use sudo ls -la ? How do I pass the command and the password. In Terminal I
> always do the sudo + command, it then asks for my password which I enter.
> How do I do these 2 steps in Rev?

Here is the way I do it:

    -- specify the shell command to use
    put "ls -la" into tCmd
    -- build the series of shell commands to sudo this
    put "#!/bin/sh" & cr into tScript
    put "pw=" & quote & tPass & quote & cr after tScript
    put "echo $pw | sudo -S " & tCmd & cr after tScript
    -- do the complete shell command
    put shell(tScript) into tCheck  -- do the command & get the result

You can either ask for the password each time, or store it in a custom
property or global for future reference.

Cheers,
Sarah



More information about the use-livecode mailing list