• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 'do shell script'-bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'do shell script'-bug?


  • Subject: Re: 'do shell script'-bug?
  • From: Christopher Nebel <email@hidden>
  • Date: Fri, 11 Jan 2002 23:09:18 -0800

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.

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. Even easier would be to use the optional "with administrator privileges" and "password" parameters.


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • Re: 'do shell script'-bug?
      • From: garbanzito <email@hidden>
    • Re: 'do shell script'-bug?
      • From: christian vick <email@hidden>
References: 
 >'do shell script'-bug? (From: christian vick <email@hidden>)

  • Prev by Date: AppleScript Logo
  • Next by Date: Re: downgrading from AS 1.7 to AS 1.6 in OS 9.2.2
  • Previous by thread: Re: 'do shell script'-bug?
  • Next by thread: Re: 'do shell script'-bug?
  • Index(es):
    • Date
    • Thread