csh(1)

csh(1)

Non-matching lists in bracket expressions are not supported.

In a list of words specifying ®le name substitution it is an error for no pattern to match an existing ®le name, but it is not required for each pattern to match.

The metanotation a{b,c,d}e is a shorthand for "abe ace ade". Left to right order is preserved, with results of matches being sorted separately at a low level to preserve this order. This construct may be nested. Thus:

~source/s1/{oldls,ls}.c

expands to

/home/source/s1/oldls.c /home/source/s1/ls.c

whether or not these ®les exist, without any chance of error if the home directory for source is /home/source . Similarly,

../{memo,*box}

might expand to

../memo ../box ../mbox

(Note that memo was not sorted with the results of matching *box.) As a special case, {, }, and

{} are passed undisturbed.

Input/Output

The standard input and standard output of a command can be redirected with the following syntax:

< name

Open ®le name (which is ®rst variable, command and ®le name expanded) as the stan-

 

dard input.

<<word Read the shell input up to a line which is identical to word. word is not subjected to variable, ®le name or command substitution, and each input line is compared to word before any substitutions are done on this input line. Unless a quoting \, ', or Á appears in word, variable and command substitution is performed on the intervening lines, allowing \ to quote $, \ and Á. Commands which are substituted have all blanks, tabs, and newlines preserved, except for the ®nal newline which is dropped. The resultant text is placed in an anonymous temporary ®le which is given to the com- mand as standard input.

>name >! name >& name

>&! name The ®le name is used as standard output. If the ®le does not exist, it is created; if the

®le exists, it is truncated, and its previous contents are lost.

If the variable noclobber is set, the ®le must not exist or be a character special ®le (e.g., a terminal or /dev/null) or an error results. This helps prevent accidental destruction of ®les. In this case the exclamation point (!) forms can be used to suppress this check.

The forms involving the ampersand character (&) route the standard error into the speci®ed ®le as well as the standard output. name is expanded in the same way as < input ®le names are.

>>name >>& name >>! name

>>&! name Uses ®le name as standard output the same as >, but appends output to the end of the

®le. If the variable noclobber is set, it is an error for the ®le not to exist unless one of the ! forms is given. Otherwise, it is similar to >.

A command receives the environment in which the shell was invoked as modi®ed by the input-output parameters and the presence of the command in a pipeline. Thus, unlike some previous shells, commands executed from a shell script have no access to the text of the commands by default; rather they receive the original standard input of the shell. The << mechanism should be used to present inline data. This permits shell scripts to function as components of pipelines and allows the shell to block-read its input.

c

HP-UX Release 11i: December 2000

− 15 −

Section 1143