O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The set Command

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required