01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

KSH ( 1)<br />

KSH ( 1)<br />

${parameter%pattern }<br />

${parameter%%pattern }<br />

If the Korn Shell pattern matches the end of the value of<br />

parameter, then substitute the value of parameter with<br />

the matched part deleted; otherwise substitute the value<br />

of parameter.<br />

In the above, word is not evaluated unless it is to be used as the<br />

substituted string, so that, in the following example, pwd is executed<br />

only if d is not set or is null:<br />

echo ${d:- 'pwd'}<br />

If the colon ( :) is omitted from the above expressions, then the<br />

shell only checks whether parameter is set or not.<br />

The following parameters are automatically set by the Korn Shell:<br />

# The number of positional parameters in decimal.<br />

Flags supplied to the Korn Shell on invocation or<br />

by the set command.<br />

? The decimal value returned by the last executed<br />

1<br />

command.<br />

$ The process number of this shell.<br />

The last argument of the previous command.<br />

The process number of the last background command<br />

invoked.<br />

PPID The process number of the parent of the shell.<br />

PWD The present working directory set by the cd command.<br />

RANDOM<br />

Each time this parameter is referenced, a random<br />

integer is generated. The sequence of random<br />

numbers can be initialized by assigning a numeric<br />

value to RANDOM.<br />

REPLY<br />

This parameter is set by the select statement and<br />

by the read special command when no arguments<br />

are supplied.<br />

The following parameters are used by the Korn shell:<br />

CDPATH<br />

the search path for the cd command.<br />

COLUMNS<br />

If this variable is set, the value is used to define<br />

the width of the edit window for the shell edit �<br />

modes and for printing select lists.<br />

EDITOR<br />

If the value of either of these variables ends in<br />

- 6-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!