O'Reilly logo

Solaris™ 8 Advanced System Administrator's Guide, Third Edition by Janice Winsor

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

Variables

A variable is a name that refers to a temporary storage area in memory. A variable holds a value. Changing a variable's value is called assigning a value to the variable. Shell programming uses two types of variables: shell variables and environment variables. By convention, you write shell variables in lower case and environment variables in upper case.

Shell variables are maintained by the shell and are known only to the shell. Shell variables are always local and are not passed on from parent to child processes.

To display the value for any shell variable, type echo $variable.

Displaying Bourne and Korn Shell Variables

Although the Korn shell recognizes the echo command, print $variable is the preferred syntax. Optionally, you can ...

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