Understanding shell variables

You can display the shell's variables and their values by entering this command:
set 
or
set -r
set -r displays readonly shell variables.

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

Only the shell variables that are defined in the .tcshrc file are available to shell scripts and commands invoked from the shell. Environment variables are inherited by subshells, and can be displayed by entering either of these commands:
setenv
printenv
 
You can display the value of a single variable with the echo command or the printenv command. For example, either of these commands
echo $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. The shell first expands the wildcard character *.

Example: Consider:
echo *.doc

Result: 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, see the tcsh command description in z/OS UNIX System Services Command Reference.