HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

c
csh(1) csh(1)
r read access
w write access
x execute access
e existence
o ownership
z zero size
f plain file
d directory
The specified filename is command- and file-name expanded then tested to see if it has the specified rela-
tionship to the real user. If the file does not exist or is inaccessible, all inquiries return false (0). Command
executions succeed, returning true, if the command exits with status 0; otherwise they fail, returning false.
If more detailed status information is required, the command should be executed outside of an expression
and the status variable examined.
Control of the Flow
csh contains a number of commands that can be used to regulate the flow of control in command files
(shell scripts) and (in limited but useful ways) from terminal input. These commands all operate by forcing
the shell to reread or skip parts of its input and, due to the implementation, restrict the placement of some
of the commands.
The foreach, switch, and while statements, as well as the if-then-else
form of the if state-
ment require that the major keywords appear in a single simple command on an input line as shown below.
If the shell’s input is not seekable, the shell buffers input whenever a loop is being read and performs seeks
in this internal buffer to accomplish the rereading implied by the loop. (To the extent that this allows,
backward
gotos succeed on non-seekable inputs.)
Signal Handling
csh normally ignores quit signals. Jobs running in background mode are immune to signals generated
from the keyboard, including hangups. Other signals have the values which the shell inherited from its
parent. csh’s handling of interrupts and terminate signals in shell scripts can be controlled by onintr.
Login shells catch the terminate signal; otherwise this signal is passed on to children from the state in the
shell’s parent. In no case are interrupts allowed when a login shell is reading the file
.logout.
Command Line Parsing
csh splits input lines into words at blanks and tabs. The following exceptions (parser metacharacters) are
considered separate words:
& ampersand;
| vertical bar;
; semicolon;
< less-than sign;
> greater-than sign;
( left parenthesis;
) right parenthesis;
&& double ampersand;
|| double vertical bar;
<< double less-than sign;
>> double greater-than sign;
# comment delimiter
The backslash (\) removes the special meaning of these parser metacharacters. A parser metacharacter
preceded by a backslash is interpreted as its ASCII value. A newline character (ASCII 10) preceded by a
backslash is equivalent to a blank.
Strings enclosed in single or double quotes form parts of a word. Metacharacters in these strings, including
blanks and tabs, do not form separate words. Within pairs of backslashes or quotes, a newline preceded by
a backslash gives a true newline character.
When csh’s input is not a terminal, the # character introduces a comment terminated by a newline.
CSH VARIABLES
csh maintains a set of variables. Each variable has a value equal to zero or more strings (words). Vari-
ables have names consisting of up to 80 letters and digits starting with a letter. The underscore character
is considered a letter. The value of a variable may be displayed and changed by using the set and
HP-UX 11i Version 1: September 2005 11 Hewlett-Packard Company Section 1139