Hitachi

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


set command (sets shell options, creates an array, or displays variable values)

Organization of this page

Format

set  [-a|+a] [-f|+f] [-u|+u] [-v|+v] [-x|+x]
     [{-o|+o} [opt]]...
     [{-A|+A} name] [--] [val ...]

Description

The command sets specified shell options, creates an array, or displays variable values.

This command can be used both to set shell options and to create an array. If you do both at the same time, you must specify the shell options first, followed by array creation. If you specify the array creation first, everything after the -A option will be interpreted as array name and element value specifications.

Arguments

You can specify more than one option at the same time. If the same option is specified more than once, the last specification takes effect.

If no options are specified, all variables that have been assigned are output to the standard output in the format variable-name=value.

-a|+a
  • -a: Enables the allexport option.

  • +a: Disables the allexport option.

-f|+f
  • -f: Enables the noglob option.

  • +f: Disables the noglob option.

-u|+u
  • -u: Enables the nounset option.

  • +u: Disables the nounset option.

-v|+v
  • -v: Enables the verbose option. When the verbose option is enabled, all lines that are read as input to the shell are output to the standard output. All input lines are output, regardless of category, such as control statement or command. The items that are output include even the following:

    [Figure] Comments

    [Figure] Nonexistent commands

    [Figure] Commands that are not executed because they do not satisfy the conditions in an if, case, or similar statement

    [Figure] Commands that are not executed because the loop in a while statement, for statement, or other looping structure is never entered

    [Figure] Job steps that are skipped by means of the run attribute

  • +v: Disables the verbose option.

-x|+x
  • -x: Enables the xtrace option.

  • +x: Disables the xtrace option.

-o|+o
  • -o: Enables the shell option specified in opt. In addition, displays a list of the shell options that are currently set.

  • +o: Disables the shell option specified in opt. In addition, displays the shell options that are currently set, in a format that can be entered into the command line.

opt

Specifies the name of a shell option that is to be set. For details about the shell option names that can be specified, see 5.6 Shell options.

-A|+A

Specifies that values are to be assigned to an array.

If you execute the command with the -A option specified and the array or variable specified in name already exists, the command deletes the contents of name and then creates the array or variable by assigning to it the values specified in val. The command creates as many array elements as there are arguments specified in val.

If you execute the command with the -A option specified and the array or variable specified in name already exists, the command assigns the values specified in val to the array or variable specified in name without deleting the contents of name. If the number of element values to be assigned is fewer than the number of elements existing in the array, the values of the array elements to which no value is assigned remain unchanged. If the array or variable specified in name does not exist, the command processing is the same as when the -A option is specified.

The number of array elements must be within the rage of 2 to 65,536. If only one value is specified, the command creates a variable rather than an array. Multiple arrays cannot be created simultaneously.

name

Specify the name to be assigned to the array that is being created. If you specify a read-only variable, the command terminates with an error.

--

Specifies the end of the option specifications. Any options specified after this option are interpreted as part of val.

val

Specifies a value to be assigned as an element of the array that is being created. If the command is executed with only one value specified, the specified value is assigned to a positional parameter. If multiple values are specified, they are assigned to the array from left to right in the order $1, $2....

Return codes

Return code

Meaning

0

Normal termination

1

Error termination

Notes

Usage example