Some people make a shell for directories they cd to often. Other people set to hold the pathnames of directories they don't want to retype. But both of those methods make you remember directory abbreviations - and make you put new aliases or shell variables in .cshrc or .profile each time you want to add or change one. There's an easier way: the C shell's cdpath shell variable and the CDPATH variable in ksh , bash , and some versions of sh . I'll use the term "cdpath" to talk about all shells.
When you type the command
Let's say that your home directory is /home/lisa
and your current
directory is somewhere else.
Let's also say that your cdpath
has the directories /home/lisa
, and /books/troff
Some Bourne shells don't show the directory name.
All shells print an error, though, if they can't find any
So, set your cdpath to a list of the parent directories that contain directories you might want to cd to. Don't list the exact directories - list the. This list goes in your .cshrc or .profile file. For example, lisa 's .cshrc could have:
A Bourne shell user would have this in .profile :
CDPATH=:$HOME:$HOME/projects:/books/troff export CDPATH
(If your system doesn't define