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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

KSH ( 1 ) KSH(l)<br />

The value of a named parameter may also be assigned by writing:<br />

name= value [ name= value ] •••<br />

If the integer attribute, -i, is set for name , the value is subject to<br />

arithmetic evaluation as described below. Positional parameters,<br />

parameters denoted by a number, may be assigned values with the<br />

set special command. Parameter $0 is set from argument zero<br />

when the Korn Shell is invoked. The character $ is used to introduce<br />

substitutable parameters .<br />

${parameter}<br />

The value, if any, of the parameter is substituted. The<br />

braces are required when parameter is followed by a<br />

Jetter, digit, or underscore that is not to be interpreted as<br />

part of its name or when a named parameter is subscripted.<br />

If parameter is a digit then it is a positional<br />

parameter. If parameter is * or @, then all the positional<br />

parameters, starting with $1, are substituted (separated<br />

by spaces). If an array identifier with subscript * or @ is<br />

used, then the value for each of the elements is substituted<br />

(separated by spaces).<br />

${#parameter}<br />

If parameter is not *, the length of the value of the<br />

parameter is substituted. Otherwise, the number of positional<br />

parameters is substituted.<br />

${#identifier[*]}<br />

The number of elements in the array identifier is substituted.<br />

${parameter:-word}<br />

If parameter is set and non-null then substitute its value;<br />

otherwise substitute word .<br />

${parameter :=word}<br />

If parameter is not set or is null then set it to word; the<br />

value of the parameter is then substituted. Positional<br />

parameters may not be assigned to in this way.<br />

${parameter:?word}<br />

If parameter is set and is non-null then substitute its<br />

value; otherwise, print word and exit from the shell. If<br />

word is omitted then a standard message is printed.<br />

${parameter:+word}<br />

If parameter is set and is non-null then substitute word;<br />

otherwise substitute nothing.<br />

${parameter# pattern }<br />

${parameter## pattern }<br />

If the Korn Shell pattern matches the beginning of the<br />

value of parameter, then the value of this substitution is<br />

the value of the parameter with the matched portion<br />

deleted; otherwise the value of this parameter is substituted.<br />

- 5 -

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

Saved successfully!

Ooh no, something went wrong!