Every time you start a C shell - in a , the command, a shell script, an , etc.-the csh reads the .cshrc file in your home directory. Some of those shells are "noninteractive," which means the shell is running a single command or reading from a - you won't be typing any commands yourself. If your .cshrc has commands like , , and others that are only useful in interactive shells, it wastes time to make noninteractive shells read them.
You can tell the shell to skip commands that will only be used in interactive shells. Set up your .cshrc this way:
# COMMANDS FOR ALL C SHELLS: set path = (...whatever...) ... if (! $?prompt) goto cshrc_end # COMMANDS FOR INTERACTIVE SHELLS ONLY: alias foo bar ... set cdpath = (~ ~joe/project) cshrc_end:
Of course, if you
! $?prompt test.
Otherwise, the test will always fail!
NOTE: Some books tell you to use a test like this instead:if (! $?prompt) exit # commands for interactive shells only: ...
explains another problem that this
$?prompt test solves.