csh.1 (2010 09)

c
csh(1) csh(1)
In any case, the single final newline does not force a new word. Note that it is thus possible for a com-
mand substitution to yield only part of a word, even if the command outputs a complete line.
File name Substitution
Each command word is processed as a pattern for file name substitution, also known as globbing, and
replaced with a sorted list of file names which match the pattern. The form of the patterns is the Pattern
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 exist-
ing 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 con-
struct 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
standard 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 inter-
vening 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 command 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
HP-UX 11i Version 3: September 2010 15 Hewlett-Packard Company 15