If you do a lot of work in some particular directories, it can be handy to make
aliases (
10.2
)
that take you to each directory quickly. For example, this C shell alias lets you type
pwr
to change to the
/books/troff/pwrtools
directory:
alias pwr cd /books/troff/pwrtools
(If your shell doesn't have aliases, you can use a shell function ( 10.9 ) . A shell script ( 1.5 ) won't work, though, because it runs in a subshell ( 38.4 ) .)
When you pick the alias names, it's a good idea not to conflict with command names that are already on the system. Article 44.21 shows how to pick a new name.
If you have a lot of these directory-changing aliases, you might want to put them in a separate file named something like .cd_aliases . Then add these lines to your .cshrc file:
source ~ |
alias setcds source ~/.cd_aliases setcds |
---|
That reads your aliases into each shell. If you edit the
.cd_aliases
file, you can read the new file into your shell by typing
setcds
from any directory.
Finally, if you're in a group of people who all work on the same directories, you could make a central alias file that everyone reads from their .cshrc files as they log in. Just use the setup above.
-