Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide


6.2.21 Setting a variable value (set command)

The set command sets a value for a shell variable. By specifying an assignment expression in the argument, you can evaluate the expression and then set a value in the variable. There is no abbreviation for the set command. The following shows the format of the set command:

set assignment-expression

The following shows the format of assignment expression:

variable-name={variable-name|numeric-value|"character-string"}

The following describes the set command's processing.

When the set command argument is specified
  • Assignment expression

    The command sets a variable value according to the specified assignment expression.

  • Assignment expression containing a variable name that has not been created

    The command outputs an error message.

  • Other than an assignment expression

    The command outputs an error message.

When the set command argument is omitted

The command outputs an error message.

Notes:

Examples

To assign a numeric value, you must use the -i attribute of the typeset command to declare the variable's type as integer.

Assign numeric value 10 to variable a
(adshdb) set a=10
Assign character string test to variable b
(adshdb) set b="test"
Assign the value of variable a to variable c
(adshdb) set c=a
Assign numeric value 1 to variable d[5](array)
(adshdb) set d[5]=1