如果文件名有空格,那么ls赋值给变量,然后用for的时候,就会有问题。办法是设置IFS变量为换行,那么切割的时候,就按换行切割就能循环获得所有的文件名了。
1 2 3 4 5 6 7  | a=`ls -1`IFS=$'\n'for b in $a ; do     echo process "$b"     ffmpeg -i "$b" -ss 00:00:03 -acodec copy "../music2/$b" &> /dev/null \        || echo failed done |