HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

c
csh(1) csh(1)
Sanity
C shell restores your terminal to a sane mode if it appears to return from some command in raw, cbreak, or
noecho mode.
Saving Your History Buffer
csh has the ability to save your history list between login sessions. If the shell variable
savehist is set
to a number, that number of command events from your history list is saved. For example, placing the line
set history=10 savehist=10
in your .cshrc file maintains a history buffer of length 10 and saves the entire list when you logout.
When you log back in, the entire buffer is restored. The commands are saved in the file
.history in
your login directory.
EXTERNAL INFLUENCES
Environment Variables
LC_COLLATE determines the collating sequence used in evaluating pattern matching notation for file
name substitution.
LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classification
of characters as letters, and the characters matched by character class expressions in pattern matching
notation.
LANG determines the language in which messages are displayed.
If LC_COLLATE or LC_CTYPE is not specified in the environment or is set to the empty string, the value
of LANG is used as a default for each unspecified or empty variable. If
LANG is not specified or is set to the
empty string, a default of "C" (see lang(5)) is used instead of
LANG. If any internationalization variable
contains an invalid setting,
csh behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
WARNINGS
The .cshrc file should be structured such that it cannot generate any output on standard output or stan-
dard error, including occasions when it is invoked without an affiliated terminal. rcp(1) causes
.cshrc to
be sourced, and any output generated by this file, even to standard error causes problems. Commands such
as stty(1) should be placed in
.login, not in .cshrc, so that their output cannot affect rcp(1).
csh has certain limitations. Words or environment variables can be no longer than 10240 characters. The
system limits argument lists to 10240 characters. The number of arguments to a command which involves
file name expansion is limited to one-sixth the number of characters allowed in an argument list. Com-
mand substitutions may substitute no more characters than are allowed in an argument list.
To detect looping, the shell restricts the number of alias substitutions on a single line to 20.
When a command is restarted from a stop, csh prints the directory it started in if it is different from the
current directory; this can be misleading (i.e., wrong) because the job may have changed directories inter-
nally.
Shell built-in functions are not stoppable/restartable. Command sequences of the form a;b;c
are
also not handled gracefully when stopping is attempted. If you interrupt
b, the shell then immediately exe-
cutes c. This is especially noticeable if this expansion results from an alias. It suffices to place the
sequence of commands in parentheses to force it into a subshell; i.e., (a;b;c).
Because of the signal handling required by csh, interrupts are disabled just before a command is executed,
and restored as the command begins execution. There may be a few seconds delay between when a com-
mand is given and when interrupts are recognized.
Control over tty output after processes are started is primitive; perhaps this will inspire someone to work
on a good virtual terminal interface. In a virtual terminal interface much more interesting things could be
done with output control.
Alias substitution is most often used to clumsily simulate shell procedures; shell procedures should be pro-
vided rather than aliases.
Commands within loops, prompted for by ?, are not placed in the history list. Control structure should be
parsed rather than being recognized as built-in commands. This would allow control commands to be
HP-UX 11i Version 1: September 2005 17 Hewlett-Packard Company Section 1145