• 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: Another shell script query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another shell script query


  • Subject: Re: Another shell script query
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 5 Jun 2002 20:54:25 -0700

On Wednesday, June 5, 2002, at 05:43 PM, Simon Kornblith wrote:

On 6/5/02 7:41 PM, "garbanzito" <email@hidden> wrote:

at 2002 06 05, 22:12 +0100, they whom i call Charles Arthur,
UKClimbing Editor wrote:
Why doesn't this work?

do shell script "curl --help"

(You can replace "curl" with most Unix things).
It works in the Terminal but from AS gives "execution error". I'm
suspecting that the output is not stdout but stderr, though I'm at a loss
as to how to deal with that.

that was a good guess, but it's actually that "curl --help"
for some reason has an exit status of 2, which "do shell
script" reasonably interprets as an error.

Try the following:

try
do shell script "curl --help"
on error theError -- theError contains the output from curl
display dialog theError
end try

Alternatively, you can suppress the error in the shell script itself like this:

do shell script "curl --help || echo -n"

The "||" means "if the previous command on the left fails, do the command on the right." echo -n prints nothing and succeeds, so you get all the output and it claims success. (There are probably other ways to do this; this is just the first one that came to mind.)


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Another shell script query (From: Simon Kornblith <email@hidden>)

  • Prev by Date: Re: OSAX on X
  • Next by Date: TypeText on OS X?
  • Previous by thread: Re: Another shell script query
  • Next by thread: Re: Another shell script query
  • Index(es):
    • Date
    • Thread