c
csh(1) | csh(1) |
The operators *=, +=, etc., are available as in C. White space can optionally separate the name from the assignment operator. However, spaces are mandatory in separating components of expression which would otherwise be single words.
Special post®x ++ and - - operators increment and decrement name, respectively (e.g., @ i++).
When a command to be executed is not a
Commands placed inside parentheses are always executed in a subshell. Thus
(cd ; pwd)
prints the home directory then returns to the current directory upon completion, whereas:
cd ; pwd
remains in the home directory upon completion.
When commands are placed inside parentheses, it is usually to prevent chdir from affecting the current shell.
If the ®le has execute permissions but is not an executable binary ®le, it is assumed to be a script ®le, which is a ®le of data for an interpreter that is executed as a separate process.
csh ®rst attempts to load and execute the script ®le (see exec(2)). If the ®rst two characters of the script ®le are #!, exec(2) expects an interpreter path name to follow and attempts to execute the speci®ed interpreter as a separate process to read the entire script ®le.
If no #! interpreter is named, and there is an alias for the shell, the words of the alias are inserted at the beginning of the argument list to form the shell command. The ®rst word of the alias should be the full path name of the command to be used. Note that this is a special,
If no #! interpreter is named and there is no shell alias, but the ®rst character of the ®le is #, the interpreter named by the $shell variable is executed (note that this normally would be /usr/bin/csh , unless the user has reset $shell). If $shell is not set, /usr/bin/csh is exe- cuted.
If no !# interpreter is named, and there is no shell alias, and the ®rst character of the ®le is not #, /usr/bin/sh is executed to interpret the script ®le.
History Substitutions
History substitutions enable you to repeat commands, use words from previous commands as portions of new commands, repeat arguments of a previous command in the current command, and ®x spelling or typing mistakes in an earlier command.
History substitutions begin with an exclamation point (!). Substitutions can begin anywhere in the input stream, but cannot be nested. The exclamation point can be preceded by a backslash to cancel its special meaning. For convenience, an exclamation point is passed to the parser unchanged when it is followed by a blank, tab, newline, equal sign, or left parenthesis. Any input line that contains history substitution is echoed on the terminal before it is executed for veri®cation.
Commands input from the terminal that consist of one or more words are saved on the history list. The history substitutions reintroduce sequences of words from these saved commands into the input stream. The number of previous commands saved is controlled by the history variable. The previous command is always saved, regardless of its value. Commands are numbered sequentially from 1.
You can refer to previous events by event number (such as !10 for event 10), relative event location (such as
Section 1−136 | − 8 − |