linux 批处理带空格文件

来源:岁月联盟 编辑:exp 时间:2011-10-31

 

写下载PT种子文件脚本时,发觉种子是带空格的。google了一些资料,可以通过修改shell的分隔符来处理。

 

 #!/bin/sh 

 files=` find . -type f -name '*.txt' ` 

 ifs=$IFS  

 IFS="/n" 

 for file in $files ; do 

     echo "$file" 

done 

 IFS=$ifs 

 

结果:

 

./a b.txt 

 

摘自 杨军的博客