Shell Command with Sudo
justin.sloan at us.army.mil
Sat Jun 12 03:53:03 EDT 2010
Thanks to all who replied. With you help and some additional research
I came up with a solution.
Mac OS X bash shell only allows results from commands to be piped in
to another command, including sudo, not plain text. The solution is to
set a bash variable (pw=password) and echo the variable to pipe it
into sudo (echo $pw | sudo -S command). In Rev you must set the
variable and pipe it in on the same shell() call. Like this:
shell("pw=" & tPassword & "; echo $pw | sudo -S command")
Works like a charm, and it's an elegant solution without a lot of
hashed code. I have not tested this on other Unix based systems but
the command should work on any system with bash as the default shell.
On Fri, Jun 11, 2010 at 6:51 PM, David Bovill <david at vaudevillecourt.tv> wrote:
> Don't think expect is the right way to do this - best would be to use an ssh
> key (seem to remember that is how I used to do this back when i was on Linux
> with Metacard), or else to write a bash script as a text file and then get
> rev to execute that.
> On 11 June 2010 16:33, Andre Garzia <andre at andregarzia.com> wrote:
>> I always though you could not pipe passwords into sudo. One way to do this
>> kind of stuff is to use the "expect" tool.
>> With expect you can automate many command line things.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode