- 论坛徽章:
- 1
|
shell 十三問?
上面的 IFS=; 其實就是:
IFS=
將值設為 null
然後補一個" ; " 的 meta ...
昨晚的文章,一開始就提到 IFS 的作用了:
是 breaks command line down to each word 用的...
而 command line 則是 processes word by word 進行的,
若碰到 meta 或 key words ,會先處理之,等到所有的 words 都處理完畢,
那才開始傳給 shell 處理...
man bash 在 Special Parameters 那節有提到:
- * Expands to the positional parameters, starting from
- one. When the expansion occurs within double
- quotes, it expands to a single word with the value
- of each parameter separated by the first character
- of the IFS special variable. That is, "$*" is
- equivalent to "$1c$2c...", where c is the first
- character of the value of the IFS variable. If IFS
- is unset, the parameters are separated by spaces.
- If IFS is null, the parameters are joined without
- intervening separators.
复制代码
請理解最後一句的意思,你就能理解 IFS= 的意思... |
|