HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)
k
ksh(1) ksh(1)
Unless -A is specified, the remaining arg arguments are positional parameters and are
assigned consecutively to
$1, $2, ... . If neither arguments nor options are given, the
values of all names are printed on the standard output.
% shift [n ] The positional parameters from
$n+1 ... are renamed $1 ... ; default n is 1. The parame-
ter n can be any arithmetic expression that evaluates to a non-negative number less than or
equal to
$#.
test [ expr ] Evaluate conditional expression expr. See test(1) for usage and description. The arithmetic
comparison operators are not restricted to integers. They allow any arithmetic expression.
Four additional primitive expressions are allowed:
-L file True if file is a symbolic link.
file1
-nt file2 True if file1 is newer than file2.
file1
-ot file2 True if file1 is older than file2.
file1
-ef file2 True if file1 has the same device and i-node number as file2.
% times Print the accumulated user and system times for the shell and for processes run from the
shell.
% trap [ arg ][sig ... ]
arg is a command read and executed when the shell receives signal(s) sig. (Note that arg is
scanned once when the trap is set and once when the trap is taken.) Each sig can be given
as a number or name of the signal. Trap commands are executed in signal number order.
Any attempt to set a trap on a signal that was ignored upon entering the current shell has
no effect. If arg is omitted or is
-, all traps for sig are reset to their original values. If arg
is the null string, this signal is ignored by the shell and by the commands it invokes. If sig
is
DEBUG, arg is executed after each command. If sig is ERR, arg is executed whenever a
command has a nonzero exit code. If sig is
0 or EXIT and the trap statement is exe-
cuted inside the body of a function, the command arg is executed after the function com-
pletes. If sig is
0 or EXIT for a trap set outside any function, the command arg is exe-
cuted on exit from the shell. The
trap command with no arguments prints a list of com-
mands associated with each signal number.
%% typeset [ ±LRZfilrtux [ n ]][name[=value ]] ...
Parameter assignments remain in effect after the command completes. When invoked
inside a function, a new instance of the parameter name is created. The parameter value
and type are restored when the function completes. The following list of attributes can be
specified:
-L Left justify and remove leading blanks from value.Ifn is nonzero, it defines the
width of the field. Otherwise, it is determined by the width of the value of first
assignment. When the name is assigned, the value is filled on the right with blanks or
truncated, if necessary, to fit into the field. Leading zeros are removed if the
-Z
option is also set. The -R option is turned off.
-R Right justify and fill with leading blanks. If n is nonzero, it defines the width of the
field. Otherwise, it is determined by the width of the value of first assignment. The
field is left-filled with blanks or truncated from the end if the parameter is reassigned.
The -L option is turned off.
-Z Right justify and fill with leading zeros if the first non-blank character is a digit and
the -L option has not been set. If n is nonzero, it defines the width of the field. Oth-
erwise, it is determined by the width of the value of first assignment.
-f Cause name to refer to function names rather than parameter names. No assign-
ments can be made to the name declared with the typeset statement. The only
other valid options are -t (which turns on execution tracing for this function) and
-x (which allows the function to remain in effect across shell procedures executed in
the same process environment).
-i Parameter is an integer. This makes arithmetic faster. If n is nonzero, it defines the
output arithmetic base; otherwise the first assignment determines the output base.
-l Convert all uppercase characters to lowercase. The uppercase -u option is turned
off.
-r Any given name is marked "read only" and cannot be changed by subsequent assign-
ment.
-t Tag the named parameters. Tags are user definable and have no special meaning to
the shell.
504 Hewlett-Packard Company − 16 − HP-UX 11i Version 3: February 2007