shell

Sarah Reichelt sarah.reichelt at gmail.com
Wed Jan 6 18:29:52 EST 2010


> I want to write a GUI to connect to the server. Now I see in Rev, when a
> shell command is issued its sent and returns the prompt, if I need to
> respond to that prompt then it issues a different shell session and not a
> continuation of the previous one, e.g. I want to connect to a server or
> change user, put shell("su - userABC") it returns "password" that means that
> it wants a password to continue now where and who can I provide a password
> it should continue the current session? In terminal I just type it in and
> its done.

Here is a command I use for setting the system clock on OS X.
It builds a multi-line set of shell commands, including the su
password, then sends them to the Rev shell() function as a single
command.

on setClock pPassword, pDate, pTime
   -- build the command lines
    put "#!/bin/sh" & cr into tScript
    put "pw=" & quote & pPassword & quote & cr after tScript
    put "echo $pw | sudo -S date " & pDate & pTime & cr after tScript

    -- do the command & get the result
    put shell(tScript) into tCheck
end setClock

To alter to use your command, change the following line:
    put "echo $pw | sudo -S date " & tDate & tTime & cr after tScript

Leave everything up to & including the -S, then put your command &
it's parameters in place of my date command.

HTH,
Sarah



More information about the use-livecode mailing list