Understanding shell variables
You can display the shell's variables and their values by entering
this command:
set
You
may see many variables that you don't recognize. These are built-in,
or predefined, variables that are set up with default values
when you start the shell.You can customize the built-in variables by setting their value in your .profile. Only the variables IFS, PS1, and PS2 support double-byte characters for the values.
Only the shell variables that are exported are available to shell scripts and commands invoked from the shell. Environment variables are a subset of shell variables that have been exported.
You can display the environment variables and their values by entering
either of these commands:
env
printenv
You can display the value of a single variable with the echo command,
the print command, or the printenv command. For example, any of these commands
echo $HOME
print $HOME
printenv $HOME
displays the current value of the HOME variable.In general, echo displays the current
values of all its arguments, after any shell processing has taken
place. For example, consider:
echo *.doc
The
shell first expands the wildcard character *.
This produces the names of every file in the working directory that
has the suffix .doc. So the output of echo is
a list of all such files. And if there are no file names ending in .doc,
the command output is just *.doc.For more information about shell variables,
- Built-in variables are listed in a table in the sh command description in z/OS UNIX System Services Command Reference.
- There is an appendix that lists shell variables in z/OS UNIX System Services Command Reference.