我在兩臺機器上使用CentOS 6.4 final。我正在執行一個腳本。 的腳本包含find
命令找到:路徑必須在表達式前
path=$1
searchstring=$2
echo `find $path -name $searchString`
for filename in `find $path -name $searchString`
do
echo "$filename"
echo
done
./findfiles.sh /var/log/ *.txt
上述腳本正在執行精細和打印文件。但是在第二臺機器我得到usage error: find: paths must precede expression
背後的原因是* .TXT它得到了在發現command.After的文件名改變 在find $path -name "$searchString"
它執行罰款擴大。
爲什麼在第一個CentOS機器中沒有發生語法錯誤?
類似:http://stackoverflow.com/questions/6495501/find-paths-must-precede-expression-how-do-i-specify-a-recursive-search-that – trante