
ksh(1) | ksh(1) |
file1
True if ®le1 exists and is older than ®le2.
True if ®le1 and ®le2 exist and refer to the same ®le. True if string matches pattern.
True if string does not match pattern.
True if string1 comes before string2 based on ASCII value of their characters. True if string1 comes after string2 based on ASCII value of their characters. True if exp1 is equal to exp2.
True if exp1 is not equal to exp2. True if exp1 is less than exp2. True if exp1 is greater than exp2.
True if exp1 is less than or equal to 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
<word | Use ®le word as standard input (®le descriptor 0). | ||
>word | Use ®le word as standard output (®le descriptor 1). If the ®le does not exist, it is | ||
| created. If the ®le exists, and the noclobber option is on, an error occurs; other- | ||
| wise, the ®le is truncated to zero length. | ||
>word | Sames as >, except that it overrides the noclobber option. | ||
>>word | Use ®le word as standard output. If the ®le exists, output is appended to it (by ®rst | ||
| searching for the | ||
<>word | Open ®le word for reading and writing as standard input. If the ®le does not exist it | ||
| is created. |
|
|
<<[ - ]word | The shell input is read up to a line that matches word, or to an | ||
| eter substitution, command substitution, or ®le name generation is performed on | ||
| word. The resulting document, called a | ||
| 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, | |
| \ must be used to quote the characters \, $, Á, and the | ||
| ®rst 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 ®le descriptor digit (see dup(2)). | ||
>&digit | The standard output is duplicated to ®le descriptor digit (see dup(2)). | ||
<&- | The standard input is closed. | ||
>&- | The standard output is closed. | ||
<&p | The input from the | ||
>&p | The output to the | ||
If one of the above is preceded by a digit, the ®le descriptor number cited is that speci®ed by the digit (instead of the default 0 or 1). For example:
... 2>&1
means ®le descriptor 2 is to be opened for writing as a duplicate of ®le descriptor 1.
k
− 8 − | Section 1−403 |