Re: 'do shell script'-bug?
Re: 'do shell script'-bug?
- Subject: Re: 'do shell script'-bug?
- From: christian vick <email@hidden>
- Date: Sat, 12 Jan 2002 09:11:04 +0100
on 1/12/02 8:09 AM, Christopher Nebel at email@hidden wrote:
>
On Friday, January 11, 2002, at 07:31 PM, christian vick wrote:
>
>
> If i use...
>
>
>
> tell application "Terminal"
>
> do script with command "echo password | sudo bless -folder9
>
> \"/Volumes/9disk/System Folder 922\" -setOF"
>
> end tell
>
>
>
> ... it works. But if i use...
>
>
>
> do shell script "echo password | sudo bless -folder9
>
> \"/Volumes/9disk/System
>
> Folder 922\" -setOF"
>
>
>
> ... i get an error "sudo: bless: command not found".
>
> Is this a bug or am i missing something?
>
>
This is not a bug, but it's also not well documented.
>
>
When you tell Terminal to do something, it does it using your preferred
>
shell (tcsh, unless you've changed it) and complete login environment.
>
When you use "do shell script", it always uses sh, and some environment
>
bits are different. In particular, PATH is not the same, so not all
>
commands can be found automatically. (Try "echo $PATH" both ways to see
>
what I mean.) Use the full path to the command (/usr/sbin/bless in this
>
case) and you should be fine.
That works! Great, thank you!
>
I'm not sure what you're doing with the "echo password | sudo", though.
>
I presume you're trying to supply the sudo password via echo, but you'll
>
need to say "sudo -S" for that to work.
Yes, i figured it out in the meantime.
>
Even easier would be to use the
>
optional "with administrator privileges" and "password" parameters.
Yes, i just prefered to have the same string for testing between Terminal
and 'do shell script'.
Greetings
cris :-)
--
English is my second language.