我正在使用下面的腳本從資料夾中刪除文件
script.sh
文件僅包含這一行:
find /usr/filesfolder -type f -iname '*' -mindepth 1 -mtime +1825 -exec rm {} \
Autosys 作業總是會失敗並顯示下列錯誤輸出:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
/usr/scripts/cleanupfiles.sh[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]: .[5]:
答案1
find 的選項-exec
必須以分號終止(並從 shell 中轉義),例如-exec rm {} \;