6.2.20 Displaying shell variable information (info variables command)
The info variables command displays information about all types of shell variables. The abbreviation for the info variables command is i v. The following shows the format of the info variables command:
info variables[ variable-name]
When a variable name is specified in the argument, the command displays information about the specified shell variable. If the argument is not specified, the command displays information about all shell variables. The following shows the display format:
variable-name = variable-value [(Step local)] ...
variable-name: Name of a shell variable. When all shell variables are displayed, the command displays the information in ASCII code order of the shell variable names.
variable-value: Value of the shell variable. For a shell variable that is valid only within a job step, the command adds the supplementary information Step local. A shell variable that is valid only within a job step is one that is specified in the stepVar attribute of the #-adsh_step_start extended script command.
For a variable that has no value, the command displays neither the equal sign (=) nor a variable value. The following shows the display format:
variable-name[(Step local)]
The following describes the info variables command's processing.
- When the info variables command argument is omitted
The command displays information about all shell variables.
- When the info variables command argument is specified
If the specified variable name exists, the command displays information about the specified shell variable.
If a nonexistent variable name is specified, the command outputs an error message.
- Notes:
If the job definition script is not being run by the run command, variables cannot be displayed because the variables are not defined.
If you specify an array for the variable name, specify an array element.
-
A variable and its array 0 (example: aaa, aaa[0] and aaa[0][0]) are the same. If a variable is an array within the job definition script, the variable is represented with a subscript; if a variable is not an array, it is represented without a subscript.
When an array is created in the shell, array element zero is created automatically. Therefore, when information about all shell variables is displayed, information about element zero is also included.
- Example of output
This example displays information about all shell variables:
SHELL = /bin/sh TEMPFILE = /tmp/file01 num = 1 (Step local variable) val = 100