Shell $PATH problems
kaveh at focalimage.com
Sat Jul 10 07:42:44 CDT 2004
OK. Here is a solution. I learnt the following from my discussions on the
Apple Unix discussions forum:
When bash is invoked as an interactive login shell, or as a non-interactive
shell with the --login option, it first reads and executes commands from
the file /etc/profile, if that file exists. After reading that file, it
looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order,
and reads and executes commands from the first one that exists and is
readable. The --noprofile option may be used when theshell is started to
inhibit this behavior.
So the difference between Terminal and the RR command is that the first is
an interactive login shell, the second is not. But by saying "bash --login"
I can get the RR command to mimick the interactive behaviour by reading
from ~/.bash_profile in my case.
Now when I execute this command:
put shell("bash --login; echo $PATH")
I still get the old pathname, i.e. "/usr/bin:/bin:/usr/sbin:/sbin:/Users/kaveh"
But when I say
put shell("bash --login;" &return& "echo $PATH")
I get the new path name, just as in Terminal.
Again this might be something basic. Any idea why the return is needed?
More information about the use-livecode