“Shell 脚本中有个变量叫 IFS(Internal Field Seprator) ,内部域分隔符。完整定义是The shell uses the value stored in IFS, which is the space, tab, and newline characters by default, to delimit words for the read and set commands, when parsing output from command substitution, and when performing variable substitution.”
看IFS的网络介绍,默认就是space,tab和newline,如果说设置不对,那我这里应该设置成IFS='.txt'或者其他的?作者: wolaiye05 时间: 2012-12-24 15:05
list=`find "${HOME}/test" -type f -name "*.txt"`
IFS_old=$IFS
IFS=$'\n'
for i in ${list}
do
echo " 111 " $i
done
IFS=$IFS_old 作者: wolaiye05 时间: 2012-12-24 16:28