Every time you start a C shell - in a
shell escape (30.26
command, a shell script, an
file in your home directory.
Some of those shells are "noninteractive," which means
the shell is running a single command or reading from a
script file (1.5
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
Set up your .cshrc
# 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)
succeeds only on noninteractive shells, when the
shell hasn't set the prompt
On noninteractive shells, the command
shell skip to the line at the end of the file labeled
Of course, if you
set your own prompt (7.1
be sure to do it on some line below the
Otherwise, the test will always fail!
Some books tell you to use a test like this instead:
if (! $?prompt) exit
# commands for interactive shells only:
But some C shells will log out when they see the exit
in a .cshrc
is more portable.
explains another problem that this