One common mistake in shell setup files (Section 3.3) is lines like these:
$$ Section 27.17, `...` Section 28.14
source .aliases echo "Shell PID $$ started at `date`" >> login.log
What's wrong with those lines? Both use relative pathnames (Section 1.16) for the files (.aliases, login.log), assuming the files are in the home directory. Those lines won't work when you start a subshell (Section 24.4) from somewhere besides your home directory because your setup files for nonlogin shells (like .cshrc) are read whenever a shell starts. If you ever use the source or . commands (Section 35.29) to read the setup files from outside your home directory, you'll have the same problem.
Use absolute pathnames instead. As Section 31.11 explains, the pathname of your home directory is in the tilde (~) operator or the $HOME or $LOGDIR environment variable:
source ~/.aliases echo "Shell PID $$ started at `date`" >> ~/login.log
-- JP
Copyright © 2003 O'Reilly & Associates. All rights reserved.