HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
c
csh(1) csh(1)
Matching Notation defined by regexp(5) with the following exceptions:
• Non-matching lists in bracket expressions are not supported.
• In a list of words specifying file name substitution it is an error for no pattern to match an existing
file 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 files 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 file name (which is first variable, command and file 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, file 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 final newline which is dropped.
The resultant text is placed in an anonymous temporary file which is given to the com-
mand as standard input.
> name
>! name
>& name
>&! name The file name is used as standard output. If the file does not exist, it is created; if the
file exists, it is truncated, and its previous contents are lost.
If the variable noclobber is set, the file must not exist or be a character special file
(e.g., a terminal or /dev/null) or an error results. This helps prevent accidental
destruction of files. In this case the exclamation point (!) forms can be used to
suppress this check.
Note that the noclobber test is only applied to regular files, not to named pipes or
other file types.
The forms involving the ampersand character (&) route the standard error into the
specified file as well as the standard output. name is expanded in the same way as <
input file names are.
>> name
>>& name
>>! name
>>&! name Uses file name as standard output the same as >, but appends output to the end of the
file. If the variable noclobber is set, it is an error for the file 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 modified 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
188 Hewlett-Packard Company − 15 − HP-UX 11i Version 3: February 2007