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

k
ksh(1) ksh(1)
file1 -nt file2 True if file1 exists and is newer than file2.
file1
-ot file2 True if file1 exists and is older than file2.
file1
-ef file2 True if file1 and file2 exist and refer to the same file.
string
= pattern True if string matches pattern.
string
!= pattern True if string does not match pattern.
string1
< string2 True if string1 comes before string2 based on ASCII value of their characters.
string1
> string2 True if string1 comes after string2 based on ASCII value of their characters.
exp1
-eq exp2 True if exp1 is equal to exp2.
exp1
-ne exp2 True if exp1 is not equal to exp2.
exp1
-lt exp2 True if exp1 is less than exp2.
exp1
-gt exp2 True if exp1 is greater than exp2.
exp1
-le exp2 True if exp1 is less than or equal to exp2.
exp1
-ge exp2 True if exp1 is greater than or equal to exp2.
A compound expression can be constructed from these primitives by using any of the following, listed in
decreasing order of precedence.
(expression) True, if expression is true. Used to group expressions.
! expression True if expression is false.
expression1 && expression2 True, if expression1 and expression2 are both true.
expression1 || expression2 True, if either expression1 or expression2 is true.
Input/Output
Before a command is executed, its input and output can be redirected using a special notation interpreted
by the shell. The following can appear anywhere in a simple-command or can precede or follow a command
and are not passed on to the invoked command. Command and parameter substitution occurs before word
or digit is used, except as noted below. File name generation occurs only if the pattern matches a single file
and blank interpretation is not performed.
<word Use file word as standard input (file descriptor 0).
>word Use file word as standard output (file descriptor 1). If the file does not exist, it is
created. If the file exists, and the
noclobber option is on, an error occurs; other-
wise, the file is truncated to zero length.
>|word Sames as >, except that it overrides the noclobber option.
>>word Use file word as standard output. If the file exists, output is appended to it (by first
searching for the end-of-file); otherwise, the file is created.
<>word Open file word for reading and writing as standard input. If the file does not exist it
is created.
<<[ - ]word The shell input is read up to a line that matches word, or to an end-of-file. No param-
eter substitution, command substitution, or file name generation is performed on
word. The resulting document, called a here-document, becomes the standard
input. If any character of word is quoted, no interpretation is placed upon the charac-
ters of the document. Otherwise, parameter and command substitution occurs,
\new-line is ignored, and \ must be used to quote the characters \, $,
`, and the
first character of word.If
- is appended to <<, all leading tabs are stripped from
word and from the document.
<&digit The standard input is duplicated from file descriptor digit (see dup(2)).
>&digit The standard output is duplicated to file descriptor digit (see dup(2)).
<&- The standard input is closed.
>&- The standard output is closed.
<&p The input from the co-process is moved to standard input.
>&p The output to the co-process is moved to standard output.
If one of the above is preceded by a digit, the file descriptor number cited is that specified by the digit
(instead of the default 0 or 1). For example:
... 2>&1
means file descriptor 2 is to be opened for writing as a duplicate of file descriptor 1.
HP-UX 11i Version 1: September 2005 8 Hewlett-Packard Company Section 1417