ksh.1 (2010 09)
k
ksh(1) ksh(1)
-x Print commands and their arguments as they are executed.
- Turns off
-x and -v options and stops examining arguments for options.
-- Do not change any of the options; useful in setting
$1 to a value beginning with
-. If no arguments follow this option, the positional parameters are unset.
Using
+ instead of - before a option causes the option to be turned off. These options
can also be used when invoking the shell. The current set of options can be examined by
using $-.
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 param-
eter 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 arith-
metic 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 exe-
cuted whenever a command has a nonzero exit code. If sig is
0 or EXIT and the
trap
statement is executed inside the body of a function, the command arg is executed after
the function completes. If sig is 0 or EXIT for a trap set outside any function, the
command arg is executed on exit from the shell. The trap command with no arguments
prints a list of commands 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 reas-
signed. 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.
Otherwise, 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).
16 Hewlett-Packard Company − 16 − HP-UX 11i Version 3: September 2010