Re: Inconsistancy Between Do Shell Script and Terminal?
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