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

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
c
csh(1) csh(1)
ls -ld ˜paul
one could execute !{l}a to do
ls -ld ˜paula
while !la would look for a command starting with la.
Quoting with Single and Double Quotes
The quotation of strings by single quotes () and double quotes (" ) can be used to prevent all or some of the
remaining substitutions. Strings enclosed in single quotes are protected from any further interpretation.
Strings enclosed in double quotes are still variable- and command-expanded as described below.
In both cases the resulting text becomes (all or part of) a single word. Only in one special case (see Com-
mand Substitution below) does a double-quoted string yield parts of more than one word; single-quoted
strings never do.
Alias Substitution
csh maintains a list of aliases that can be established, displayed, and modified by the alias and
unalias commands. After a command line is scanned, it is parsed into distinct commands and the first
word of each command, left-to-right, is checked to see if it has an alias. If it does, the text which is the
alias for that command is reread with the history mechanism available as if that command was the previ-
ous input line. The resulting words replace the command and argument list. If no reference is made to the
history list, the argument list is left unchanged.
Thus, if the alias for ls is ls -l, the command ls /usr maps to ls -l /usr
, leaving the argu-
ment list undisturbed. Similarly, if the alias for
lookup was grep /etc/passwd , lookup
bill
maps to grep bill /etc/passwd .
If an alias is found, the word transformation of the input text is performed and the aliasing process begins
again on the re-formed input line. Looping is prevented if the first word of the new text is the same as the
old by flagging it to prevent further aliasing. Other loops are detected and cause an error.
Note that the mechanism allows aliasesto introduce parser metasyntax. Thus:
alias print ’pr \!* | lp’
makes a command that uses pr(1) to print its arguments on the line printer.
Expressions
Some of the built-in commands take expressions in which the operators are similar to those of C, with the
same precedence. These expressions appear in the @, exit, if, and while commands. The following
operators are available (shown in order of increasing precedence):
||&&|ˆ&==!==˜!˜<=>=<><<>>+-*/%!˜()
The following list shows the grouping of these operators. The precedence decreases from top to bottom in
the list:
*/%
+-
<< >>
<= >= < >
== !=
The operators ==, !=, , and compare their arguments as strings; all others operate on numbers.
The operators and are similar to != and ==, except that the right-hand side is a pattern (contain-
ing
*s, ?s, and instances of [...]) against which the left hand operand is matched. This reduces the need
for use of the switch statement in shell scripts when all that is really needed is pattern matching.
Strings beginning with 0 are considered octal numbers. Null or missing arguments are considered 0. The
result of all expressions are strings that represent decimal numbers. It is important to note that no two
components of an expression can appear in the same word. These components should be surrounded by
spaces except when adjacent to components of expressions that are syntactically significant to the parser:
-, &, |, <, >, (, and ).
Also availablein expressions as primitive operands are command executions enclosed in curly braces ({})
and file enquiries of the form -l filename, where l is one of:
Section 1138 10 HP-UX Release 11i: December 2000
___
___