Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Creating a 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. No spaces are allowed around
the =. For example:
sets
up a variable with the name HOME and the value /usr/macneil.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/macneil:
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/macneil 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
|