Besides manipulating Korn shell options, the set command can be used to display a list of your local and exported variables.
$ set EDITOR=vi ENV=${HOME:—.}/.env FCEDIT=/bin/ed HOME=/home/anatole LOGNAME=anatole MAILCHECK=600 PATH=:/usr/bin:/usr/ucb:/usr/5bin PPID=180 . . .
It can also be used to "manually" reset positional parameters. For example:
$ set X Y Z
would set $1 to X, $2 to Y, $3 to Z, and $# to 3:
$ print $1 $2 $3 $# X Y Z 3
The positional parameters $@ and $* would be set X Y Z:
$ print $* X Y Z $ print $@ X Y Z
The $* and $@ parameters are basically the same, except for the way they are expanded when surrounded with double quotes. The positional parameters in $@ are interpreted as separate strings, while in the $*, they are interpreted as a single string. Using $@, the wc command counts three separate strings
$ print "$@" | wc —w 3
while with $*, only one string is counted:
$ print "$*" | wc —w 1
To manually set positional parameters that begin with the – character, use the set – command.
$ set — —X —Y —Z $ print — $* —X —Y —Z
All the positional parameters can be unset with the set –– command:
$ set A B C $ print $* A B C $ set — — $ print $* $
52.15.74.25