[ISSUE]shell 命令問題

###shell

對於路徑中帶空格的,加上引號,好比 ./"JS Crystal Craze Mac.app/Contents/MacOS/JS Crystal Craze Mac"app

若是是在遍歷的路徑中帶有空格,如何處理oop

http://unix.stackexchange.com/questions/9496/looping-through-files-with-spaces-in-the-namesspa

摘錄:unix

Short answer (closest to your answer, but handles spaces)code

OIFS="$IFS" IFS=$'\n' for file in `find . -type f -name "*.csv"` do echo "file = $file" diff "$file" "/some/other/path/$file" read line done IFS="$OIFS"

Better answer (also handles wildcards and newlines in file names)get

find . -type f -name "*.csv" -print0 | while IFS= read -r -d '' file; do echo "file = $file" diff "$file" "/some/other/path/$file" read line </dev/tty done

 

###it

shell 中關閉蜂鳴器:setterm -blength 0io

相關文章
相關標籤/搜索