k

ksh(1)

ksh(1)

(" "), parameter and command substitution occurs and \ quotes the characters \, Á, ", and $. $* and $@ have identical meanings when not quoted or when used as a parameter assignment value or as a ®le name. However, when used as a command argument, "$*" is equivalent to "$1d $2d ...", where d is the ®rst character of the IFS parameter, whereas "$@" is equivalent to "$1" "$2" ... . Inside back single quote (accent grave) marks (Á Á) \ quotes the characters \, Á, and $. If the back single quotes occur within double quotes, \ also quotes the character ".

The special meaning of keywords or aliases can be removed by quoting any character of the keyword. The recognition of function names or special command names listed below cannot be altered by quoting them.

Arithmetic Evaluation

The ability to perform integer arithmetic is provided with the special command let. Evaluations are performed using long arithmetic. Constants take the form [ base# ]n, where base is a decimal number between two and thirty-six representing the arithmetic base and n is a number in that base. If base is omitted, base 10 is used.

An arithmetic expression uses the same syntax, precedence, and associativity of expression of the C language. All the integral operators, other than ++, - -, ?:, and , are supported. Variables can be referenced by name within an arithmetic expression without using the parameter substitution syntax. When a variable is referenced, its value is evaluated as an arithmetic expression.

An internal integer representation of a variable can be speci®ed with the -ioption of the typeset special command. Arithmetic evaluation is performed on the value of each assignment to a variable with the -iattribute. If you do not specify an arithmetic base, the ®rst assignment to the variable determines the arithmetic base. This base is used when parameter substitution occurs.

Since many of the arithmetic operators require quoting, an alternative form of the let command is pro- vided. For any command beginning with ((, all characters until the matching )) are treated as a quoted expression. More precisely, ((...)) is equivalent to let " ...".

Prompting

When used interactively, the shell prompts with the value of PS1 before reading a command. If at any time a new-line is typed and further input is needed to complete a command, the secondary prompt (the value of PS2) is issued.

Conditional Expressions.

A conditional expression is used with the [[ compound command to test attributes of ®les and to compare strings. Word splitting and ®le name generation are not performed on the words between [[ and ]]. Each expression can be constructed from one or more of the following unary or binary expressions:

-afile -bfile -cfile -dfile -ffile -gfile -hfile -kfile -nstring -ooption -pfile -rfile -sfile -tfildes

-ufile -wfile -xfile

-zstring -Ofile -Gfile -Sfile

file1 -ntfile2

Section 1402

True if ®le exists.

True if ®le exists and is a block special ®le. True if ®le exists and is a character special ®le. True if ®le exists and is a directory.

True if ®le exists and is an ordinary ®le. True if ®le exists and is has its setgid bit set. True if ®le exists and is a a symbolic link. True if ®le exists and is has its sticky bit set. True if length of string is non-zero.

True if option named option is on.

True if ®le exists and is a ®fo special ®le or a pipe. True if ®le exists and is readable by current process. True if ®le exists and has size greater than zero.

True if ®le descriptor number ®ldes is open and associated with a terminal dev- ice.

True if ®le exists and is has its setuid bit set.

True if ®le exists and is writable by current process.

True if ®le exists and is executable by current process. If ®le exists and is a directory, the current process has permission to search in the directory.

True if length of string is zero. -L®le True if ®le exists and is a symbolic link. True if ®le exists and is owned by the effective user ID of this process.

True if ®le exists and its group matches the effective group ID of this process. True if ®le exists and is a socket.

True if ®le1 exists and is newer than ®le2.

− 7 −

HP-UX Release 11i: December 2000