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

01.01.2013 Views

KSH ( 1) KSH ( 1) The following exported aliases are compiled into the shell but can be unset or redefined: echo='print -' false= 'let 0' history='fc -1' integer= 'typeset -i' pwd= 'print - $PWD ' r='fc -e - ' true= 'let 1' type= 'whence -v ' hash='alias -t' Tilde Substitution. After alias substitution is performed, each word is checked to see if it begins with an unquoted -. If it does, then the word up to a / is checked to see if it matches a user name in the /etc/ passwd file. If a match is found, the - and the matched login name are replaced by the login directory of the matched user. This is called a tilde substitution. If no match is found, the original text is left unchanged. A - by itself, or in front of a /, is replaced by the value of the HOME parameter. A - followed by a + or - is replaced by the value of the parameter PWD and OLDPWD respectively. In addition, the value of each keyword parameter is checked to see if it begins with a - or if a - appears after a :. In either of these cases a tilde substitution is attempted. Command Substitution. l The standard output from a command enclosed in a pair of grave accents ( ") may be used as part or all of a word; trailing newlines are removed. The command substitution 'cat file' can be replaced by the equivalent but faster '

KSH ( 1 ) KSH(l) The value of a named parameter may also be assigned by writing: name= value [ name= value ] ••• If the integer attribute, -i, is set for name , the value is subject to arithmetic evaluation as described below. Positional parameters, parameters denoted by a number, may be assigned values with the set special command. Parameter $0 is set from argument zero when the Korn Shell is invoked. The character $ is used to introduce substitutable parameters . ${parameter} The value, if any, of the parameter is substituted. The braces are required when parameter is followed by a Jetter, digit, or underscore that is not to be interpreted as part of its name or when a named parameter is subscripted. If parameter is a digit then it is a positional parameter. If parameter is * or @, then all the positional parameters, starting with $1, are substituted (separated by spaces). If an array identifier with subscript * or @ is used, then the value for each of the elements is substituted (separated by spaces). ${#parameter} If parameter is not *, the length of the value of the parameter is substituted. Otherwise, the number of positional parameters is substituted. ${#identifier[*]} The number of elements in the array identifier is substituted. ${parameter:-word} If parameter is set and non-null then substitute its value; otherwise substitute word . ${parameter :=word} If parameter is not set or is null then set it to word; the value of the parameter is then substituted. Positional parameters may not be assigned to in this way. ${parameter:?word} If parameter is set and is non-null then substitute its value; otherwise, print word and exit from the shell. If word is omitted then a standard message is printed. ${parameter:+word} If parameter is set and is non-null then substitute word; otherwise substitute nothing. ${parameter# pattern } ${parameter## pattern } If the Korn Shell pattern matches the beginning of the value of parameter, then the value of this substitution is the value of the parameter with the matched portion deleted; otherwise the value of this parameter is substituted. - 5 -

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

The following exported aliases are compiled into the shell but can<br />

be unset or redefined:<br />

echo='print -'<br />

false= 'let 0'<br />

history='fc -1'<br />

integer= 'typeset -i'<br />

pwd= 'print - $PWD '<br />

r='fc -e - '<br />

true= 'let 1'<br />

type= 'whence -v '<br />

hash='alias -t'<br />

Tilde Substitution.<br />

After alias substitution is performed, each word is checked to see<br />

if it begins with an unquoted -. If it does, then the word up to a<br />

/ is checked to see if it matches a user name in the /etc/ passwd<br />

file. If a match is found, the - and the matched login name are<br />

replaced by the login directory of the matched user. This is called<br />

a tilde substitution. If no match is found, the original text is left<br />

unchanged. A - by itself, or in front of a /, is replaced by the<br />

value of the HOME parameter. A - followed by a + or - is<br />

replaced by the value of the parameter PWD and OLDPWD<br />

respectively.<br />

In addition, the value of each keyword parameter is checked to see<br />

if it begins with a - or if a - appears after a :. In either of these<br />

cases a tilde substitution is attempted.<br />

Command Substitution. l<br />

The standard output from a command enclosed in a pair of grave<br />

accents ( ") may be used as part or all of a word; trailing newlines<br />

are removed. The command substitution 'cat file' can be<br />

replaced by the equivalent but faster '

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

Saved successfully!

Ooh no, something went wrong!