作者:crane-yuan 日期:2017-05-02
解決方法
使用IFS(the Internal Field Separator)
知举,Shell依靠它去決定如何進(jìn)行單詞分隔。
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in *
do
echo "$f"
done
IFS=$SAVEIFS
建議
在Linux或Unix系統(tǒng)中,命名文件時(shí),最好不要帶有空格,這會(huì)給自在帶來(lái)麻煩的青柄。