|
发表于 2009-7-8 18:45:10
|
显示全部楼层
另外LZ对bash根据IFS进行分词的理解是错的。
我这边的Debian testing中的bash版本是
- $ [b]bash --version[/b]
- bash --version
- GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu)
- Copyright (C) 2007 Free Software Foundation, Inc.
复制代码
bash(1)中这么对IFS这么解释:
- IFS The Internal Field Separator that is used for [color="Red"]word splitting
- after expansion[/color] and [color="Red"]to split lines into words with the read
- builtin command[/color]. The default value is ``<space><tab><new-
- line>''.
复制代码
注意红色字:IFS对命令行扩展前的分词没有影响。(证明:尽管手册中没这么说,但若是都有影响,手册作者不会写上“after expansion”,所以在扩展之前IFS并不造成影响。证明完毕。) |
|