2.6 Use Absolute Pathnames in Shell Setup FilesOne common mistake in shell setup files (2.2 ) is lines like these:
What's wrong with those lines? Both use
relative pathnames (1.21
)
for the files (.aliases
, login.log
), assuming the files
are in the home directory.
Those lines won't work when you start a
subshell (38.4
)
from somewhere besides your home directory, because your files
.cshrc
or ENV
(like .kshrc
) are read whenever
a shell starts. If you ever use the
source
or Use absolute pathnames instead. As article
14.11
explains, the pathname of your home directory is in the tilde
( source ~/.aliases echo "Logged in at `date`" >> ~/login.log - |
|