- 论坛徽章:
- 0
|
本帖最后由 hbmhalley 于 2012-05-06 14:32 编辑
polestar_li 发表于 2012-05-06 14:00 ![]()
"hehe"前面的空格是在read命令执行时候被当做IFS而没有赋值给变量a,还是再执行echo "$a"命令时候当成IFS而没有输出到屏幕上。 ...
前者
read
read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [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 intervening separators assigned to the last name.
- User@Explorer-PC ~/work
- $ read a b c
- a b c d e f g
- User@Explorer-PC ~/work
- $ echo "$a,$b,$c"
- a,b,c d e f g
复制代码 |
|