Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Creating a shell variable z/OS UNIX System Services User's Guide SA23-2279-00 |
|
The shell also lets you create variables. A shell variable name can consist of uppercase or lowercase letters, plus digits and the underscore character _. The name can have any length, but the first character cannot be a digit. Uppercase letters are distinguished from lowercase ones, so NAME, name, and Name are all different names. To create a shell variable, just enter:
as a command to the shell. For example:
sets up a variable with the name home and
the value /usr/adams.After you set a variable, you refer to it by prefixing its name
with a dollar sign ($). Any command can use the value of
a variable by referring to it this way. For example, if home is set to /usr/adams:
is
equivalent to:
Similarly:
is equivalent to:
To change the value of an existing variable, you use a command
with the same form as the existing variable. For example:
changes the value of home from /usr/adams to /usr/benjk.If the value on the right-hand side of the = sign
does not contain spaces, tab characters, or other special characters,
you can leave out the single quotation marks. For example, you can
enter:
|
Copyright IBM Corporation 1990, 2014
|