read echo >$2 不懂
(http://www.linuxsir.org/main/doc/abs/HTML/special-chars.html)
Ctl-M
Carriage return.
1 #!/bin/bash
2 # Thank you, Lee Maschmeyer, for this example.
3
4 read -n 1 -s -p $'Control-M leaves cursor at beginning of this line. Press Enter. \x0d'
5 # Of course, '0d' is the hex equivalent of Control-M.
6 echo >&2 # The '-s' makes anything typed silent,
7 #+ so it is necessary to go to new line explicitly.
8
9 read -n 1 -s -p $'Control-J leaves cursor on next line. \x0a'
10 # '0a' is the hex equivalent of Control-J, linefeed.
11 echo >&2
12
13 ###
14
15 read -n 1 -s -p $'And Control-K\x0bgoes straight down.'
16 echo >&2 # Control-K is vertical tab.
17
18 # A better example of the effect of a vertical tab is:
19
20 var=$'\x0aThis is the bottom line\x0bThis is the top line\x0a'
21 echo "$var"
22 # This works the same way as the above example. However:
23 echo "$var" | col
24 # This causes the right end of the line to be higher than the left end.
25 # It also explains why we started and ended with a line feed --
26 #+ to avoid a garbled screen.
27
28 # As Lee Maschmeyer explains:
29 # --------------------------
30 # In the [first vertical tab example] . . . the vertical tab
31 #+ makes the printing go straight down without a carriage return.
32 # This is true only on devices, such as the Linux console,
33 #+ that can't go "backward."
34 # The real purpose of VT is to go straight UP, not down.
35 # It can be used to print superscripts on a printer.
36 # The col utility can be used to emulate the proper behavior of VT.
37
38 exit 0
man上的read用法说明(read是 BASH_BUILTINS(1)的成员)
NAME
bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen,
complete, continue, declare, dirs, disown, echo, enable, eval, exec,
exit, export, fc, fg, getopts, hash, help, history, jobs, kill, let,
local, logout, popd, printf, pushd, pwd, read, readonly, return, set,
shift, shopt, source, suspend, test, times, trap, type, typeset,
ulimit, umask, unalias, unset, wait - bash built-in commands, see
bash(1)
read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d
delim] [name ...]
One line is read from the standard input, or from the file
descriptor fd supplied as an argument to the -u option, and the
first word is assigned to the first name, the second word to the
second name, and so on, with leftover words and their interven-
ing separators assigned to the last name. If there are fewer
words read from the input stream than names, the remaining names
are assigned empty values. The characters in IFS are used to
split the line into words. The backslash character (\) may be
used to remove any special meaning for the next character read
and for line continuation.
[mdx@localhost mdx]$ read a b
12 34
[mdx@localhost mdx]$ echo $a
12
[mdx@localhost mdx]$ echo $b
34
[mdx@localhost mdx]$