Hitachi

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


read command (reads from the standard input and stores the input in variables)

Organization of this page

Format

read  [-p] [-r] [-u [num]] [varname ...]

Description

This command reads one line at a time from the standard input and stores the input in specified shell variables.

Arguments

-p

Specifies that the command is to read from the output of a background process through a pipe.

-r

Specifies that when there is a \ at the end of a line, the next line is not to be read as a continuation line.

-u [num]

Specifies the file identifier of the file from which the input is to be read. If no value is specified, the standard input is read.

Specify either a file identifier or p. Specifying p is equivalent to specifying the -p option.

varname

Specifies the name of a variable in which input that is read is to be stored.

When multiple variable names are specified, the input line is split into the fields delimited by the delimiter set in the IFS variable, and the fields are assigned to the variable names in sequential order (input line's first field is set in the first variable, second field is set in the second variable, and so on).

If the number of fields exceeds the number of variable names, the values of all the remaining fields are stored in the last variable that is specified.

If there are fewer fields than there are variables, a linefeed is set in each additional variable.

Return codes

Return code

Meaning

0

Normal termination

1

Normal termination

  • The end of file (EOF) was detected.

Error termination

  • Other than the above.

Notes

Usage examples