• 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: Inconsistancy Between Do Shell Script and Terminal?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistancy Between Do Shell Script and Terminal?


  • Subject: Re: Inconsistancy Between Do Shell Script and Terminal?
  • From: "Jonathan Levi, M.D." <email@hidden>
  • Date: Mon, 17 Jan 2005 19:20:29 -0500

Adam's and Jake's replies were greatly appreciated!

After scrutinizing http://developer.apple.com/technotes/tn2002/tn2065.html several times, I finally located the problem:

'[When] you use just a command name instead of a complete path, the shell uses a list of directories (known as your PATH) to try and find the complete path to the command. For security and portability reasons, do shell script ignores the configuration files that an interactive shell would read..."

The active line in my shell script was

echo $(gawk					  \
'{print gensub("><", ">\n<", "g")}' "$1"	| \
sed -ne 's/.*viewarticle\/\([0-9]*\).*/\1/p'	| \
tail -n 1)

However, I'm using Fink, so gawk's full path is /sw/bin/gawk. "do shell script" had no way of knowing this without access to my PATH, so it was failing silently. Substituting "/sw/bin/gawk" for "gawk" corrected the problem. (In fact redirecting stderr to stdin by tacking "2>&1" on the end of my do shell script command brought out the error message "gawk: command not found".)

Many thanks again,

Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Call Objective-C methods from any script
  • Next by Date: Re: Applescript to read metadata of iMovie clips?
  • Previous by thread: Re: Inconsistancy Between Do Shell Script and Terminal?
  • Next by thread: Applescript to read metadata of iMovie clips?
  • Index(es):
    • Date
    • Thread