Special variables are variables that are maintained by the system. They are also referred to as system variables
, but are here referred to as special variables to avoid confusion with structured system variables.
Special variable names begin with a dollar sign ($). They can be distinguished from functions because they are not followed by parentheses and take no parameters. Special variable names are not case-sensitive. Many special variable names can be abbreviated. In the Synopsis for each special variable, the full name syntax is first presented, and below it is shown the abbreviated name (if one exists).
Historically, special variables have held scalar
values. The system automatically updates these special variables to reflect various aspects of the operating environment. For example, the $IO
special variable contains the ID of the current device. The $JOB
special variable contains the ID of the current job.
Although you can set some special variables, most are read-only. With the exception of this read-only constraint, you can treat the special variables just as you would any other variable. For example, you can reference a special variable in an expression and assign its current value to another (user-defined) variable.
Any implementation-specific special variable form is marked with the abbreviation of the platform that supports it (Windows or UNIX®). Any form that is not marked with a platform abbreviation is supported by all platforms.
Special variables are listed in alphabetical order.