ksh(1)

ksh(1)

file1 -otfile2 file1 -effile2 string = pattern string != pattern string1 < string2 string1 > string2 exp1 -eqexp2 exp1 -neexp2 exp1 -ltexp2 exp1 -gtexp2 exp1 -leexp2 exp1 -geexp2

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 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 ®le and blank interpretation is not performed.

<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 end-of-®le); otherwise, the ®le is created.

<>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 end-of-®le. No param-

 

eter substitution, command substitution, or ®le 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-lineis ignored, and

\ 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 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 ®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

HP-UX Release 11i: December 2000

− 8 −

Section 1403