ifs-empty.sh
来自「Shall高级编程」· Shell 代码 · 共 29 行
SH
29 行
#!/bin/bash# If $IFS set, but empty,#+ then "$*" and "$@" do not echo positional params as expected.mecho () # Echo positional parameters.{echo "$1,$2,$3";}IFS="" # Set, but empty.set a b c # Positional parameters.mecho "$*" # abc,,mecho $* # a,b,cmecho $@ # a,b,cmecho "$@" # a,b,c# The behavior of $* and $@ when $IFS is empty depends#+ on whatever Bash or sh version being run.# It is therefore inadvisable to depend on this "feature" in a script.# Thanks, Stephane Chazelas.exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?