|
|
1.1 root 1:
2:
3: read Command read
4:
5:
6:
7:
8: Assign values to shell variables
9:
10: rreeaadd _n_a_m_e ...
11:
12: read reads a line from the standard input. It assigns each token
13: of the input to the corresponding shell variable name. If the
14: input contains fewer tokens than the number of names specified,
15: read assigns the null string to each extra variable. If the in-
16: put contains more tokens than the number of names specified, read
17: assigns the last name in the list the remainder of the input.
18:
19: The shell sh executes read directly.
20:
21: ***** Example *****
22:
23: The command
24:
25:
26: read foo bar baz
27: hello how are you
28:
29:
30: parses the line ``hello how are you'' and assigns the tokens to,
31: respectively, the shell variables foo, bar, and baz. If you fur-
32: ther type
33:
34:
35: echo $foo
36: echo $bar
37: echo $baz
38:
39:
40: you will see:
41:
42:
43: hello
44: how
45: are you
46:
47:
48: ***** See Also *****
49:
50: commands, sh
51:
52: ***** Diagnostics *****
53:
54: read normally returns an exit status of zero. If it encounters
55: end of file or is interrupted while reading the standard input,
56: it then returns one.
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.