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 ®le 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 ®le .history in your login directory.

EXTERNAL INFLUENCES

Environment Variables

LC_COLLATE determines the collating sequence used in evaluating pattern matching notation for ®le name substitution.

LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, the classi®cation of characters as letters, and the characters matched by character class expressions in pattern matching nota- tion.

LANG determines the language in which messages are displayed.

If LC_COLLATE or LC_CTYPE is not speci®ed in the environment or is set to the empty string, the value of LANG is used as a default for each unspeci®ed or empty variable. If LANG is not speci®ed 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 ®le should be structured such that it cannot generate any output on standard output or standard error, including occasions when it is invoked without an af®liated terminal. rcp(1) causes .cshrc to be sourced, and any output generated by this ®le, 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 ®le name expansion is limited to one-sixth the number of characters allowed in an argument list. Command 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 executes c. This is especially noticeable if this expansion results from an alias. It suf®ces 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 command 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 provided 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 placed anywhere, to be combined with , and to be used with & and ; metasyntax.

HP-UX Release 11i: December 2000

− 17 −

Section 1145

c