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

Get Solaris™ 8 Advanced System Administrator's Guide, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.