read
variable1
[
variable2 ...
]
Read one line of standard input, and assign each word to
the corresponding
variable
, with all leftover words assigned to last variable. If
only one variable is specified, the entire line will be assigned to
that variable. See example below and under
case
.
The return status is 0 unless
EOF
is reached.
$
read first last address
Sarah Caldwell 123 Main Street
$
echo "$last, $first\n$address"
Caldwell, Sarah
123 Main Street