|
|
coherent
read Command read
Assign values to shell variables
rreeaadd _n_a_m_e ...
read reads a line from the standard input. It assigns each token
of the input to the corresponding shell variable name. If the
input contains fewer tokens than the number of names specified,
read assigns the null string to each extra variable. If the in-
put contains more tokens than the number of names specified, read
assigns the last name in the list the remainder of the input.
The shell sh executes read directly.
***** Example *****
The command
read foo bar baz
hello how are you
parses the line ``hello how are you'' and assigns the tokens to,
respectively, the shell variables foo, bar, and baz. If you fur-
ther type
echo $foo
echo $bar
echo $baz
you will see:
hello
how
are you
***** See Also *****
commands, sh
***** Diagnostics *****
read normally returns an exit status of zero. If it encounters
end of file or is interrupted while reading the standard input,
it then returns one.
COHERENT Lexicon Page 1
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.