Re: Shell and Perl scripts
Re: Shell and Perl scripts
- Subject: Re: Shell and Perl scripts
- From: Dave Gillam <email@hidden>
- Date: Sat, 7 May 2005 19:09:38 -0500
Ok, so obviously I mis-remembered the bash manpage. Guess we're
stuck with what I normally do without even thinking about it in
Solaris/Linux... explicitly set the path in the shell script itself.
Touché
Dave Gillam
email@hidden
On May 7, 2005, at 3:13 PM, Ron Hunsinger wrote:
At 7:26 AM -0500 5/7/05, Dave Gillam wrote:
So try duplicating the PATH assignment for BASH_ENV, thus:
# System-wide .profile for sh(1)
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH
BASH_ENV="/bin:/sbin:/usr/bin:/usr/sbin"
export BASH_ENV
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
This *should* give the script-invoked bash the path you are seeking.
Let's set aside the error that BASH_ENV is the name of a script to
run, not the desired PATH. And the error that if the added lines
are ever found, the PATH is already set correctly so they aren't
needed.
This kind of change is dangerous to a developer. It'll make things
work differently on your own machine than they do on everyone
else's. In particular, if you test something, and it works but only
because you've made your configuration non-standard, and then
distribute it to other users, they'll complain that it doesn't
work. You'll be left scratching your head and saying "I dunno, it
works on my machine. What have you done to yours that makes my good
code break?"
It doesn't even have to be a different user. When you upgrade your
OS, /etc/profile might get overwritten, and suddenly your stuff
stops working. By this time, you'll have forgotten the change you
made, and blame the upgrade for breaking your stuff.
I know this is the Automator Users list, and there's little
likelihood that you're planning to distribute your automator
scripts to others, but you need to remember that this kind of
change affects everything that executes shell commands: 'do shell
script ...' in AppleScript, 'widget.system(...)' in Dashboard
Widgets, `...` in perl, 'system(...)' from C, etc. Any of those
will behave differently on different machines and possibly across
different OS releases on your own.
-Ron Hunsinger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden