READ(1SH) COMMAND REFERENCE READ(1SH)
NAME
read - read a line from standard input (sh built-in)
SYNOPSIS
read name ...
DESCRIPTION
One line is read from the standard input; successive words
of the input are assigned to the names in order, with the
leftover words to the last variable. The return code is 0
unless the end-of-file is encountered.
EXAMPLES
The following shell script reads lines from the standard
input and echos them until a line is encountered whose first
word is end or the end of input is reached.
#!/bin/sh
while read first other
do
echo "$first" "$other"
if test "end" = "$first"
then
exit
fi
done
RETURN VALUE
[0] Data was read as requested.
[1] End-of-file has been encountered.
CAVEATS
It is not possible to redirect the input of read in the
current shell. For example, the command read f <filename
waits for input and then prints the message illegal io.
SEE ALSO
break(1sh), cd(1sh), chdir(1sh), continue(1sh), csh(1csh),
echo(1sh), eval(1sh), exec(1sh), exit(1sh), export(1sh),
hash(1sh), line(1), login(1), pwd(1sh), readonly(1sh),
return(1sh), set(1sh), sh(1sh), shift(1sh), test(1sh),
times(1sh), trap(1sh), type(1sh), ulimit(1sh), umask(1sh),
unset(1sh), wait(1sh), which(1sh), and execve(2).
Printed 4/6/89 1
%%index%%
na:288,124;
sy:412,157;
de:569,367;
ex:936,496;
rv:1432,227;
ca:1659,469;
se:2128,882;
%%index%%000000000120