Setting $PATH for non-interactive uses
david <[email protected]> Mon, 16 Jan 2006 13:04:01 +0100
| Newsgroups | gmane.os.opendarwin.general |
|---|---|
| Message-ID | <[email protected]> |
I posted a question similar to this in the Fink newsgroup. Since I
haven't received any 'final' answer from the fink people and I also use
DP I thought I could post it here as well:
The DP recommendations for setting $PATH when using tcsh are not
'compatible' with Apple's recommendations about setting up tcsh. Apple
has dedicated a special file, ~/Library/init/tcsh/path, to set $PATH but
the DP recommendation at
<http://darwinports.opendarwin.org/docs/ch01s03.html> is to use
.(t)cshrc. What gives?
Furthermore, I believe this won't even work (I currently set my $PATH in
~/Library/init/tcsh/login.mine but that is just because
~/Library/init/tcsh/path didn't exist when I begun setting up my
enviroment back in 10.1 or so) because in /usr/share/tcsh/login, that is
read after .(t)cshrc, you'll find:
set path = ( \
~/bin \
/usr/local/bin /usr/bin /bin \
/usr/local/sbin /usr/sbin /sbin \
)
As far as I can tell this resets $PATH.
However, there is a problem with setting $PATH the way I do too. For
example, when I use rsync something like this
% rsync --rsh=ssh /aDirAt1stMachine 2ndMachine:/anotherDir
it is /usr/bin/rsync that is invoked, not /opt/local/bin/rsync (I want
to use /opt/local/bin/rsync).
Similar problems apply to, among others, cron. I understand that you
under certain circumstances want a different environment with respect
to, for example, $PATH when you use cron BUT generally I guess most
people prefer to have the same enviroment for cron and regular
interactive shells. At the end of the day cron is, most of the time,
just postponed simple shell commands (which makes it different from
shell scripts that might have quite advanced logic in their own).
Why do you recommend DP-users to set it up like this? Any suggestions on
how to fix my setup issues?
Googling didn't come up with an explanation so I appreciate any input.