Issuing "sudo" cmds + password from Rev Scripts

Sarah Reichelt sarah.reichelt at
Sat Feb 16 17:37:11 EST 2008

> How do does one deal, from within a Rev script, with the shell
> requirement to enter the password before sudo executes? I saw an earlier
> thread where one might approach this by doing it thru apples script.
> Does that mean it's not possible with transcript alone?

It is possible to do this without AppleScript. Here is an example script:

-- build the command lines
 put "#!/bin/sh" & cr into tScript
 put "pw=" & quote & tPass & quote & cr after tScript
 put "echo $pw | sudo -S " & tShellCommand & cr after tScript
 -- do the command & get the result
 put shell(tScript) into tCheck

Just set the variables tPass & tShellCommand and check the value in
tCheck when finished.
You will neeed to ask for the password at least once, but then it
should be able to process whatever you need.


More information about the Use-livecode mailing list