我有以下 bash 腳本:
#!/bin/sh
dir1=/source/dir/path/
while inotifywait -qqre modify "$dir1"; do
rm -r /destination/dir/path
find /source/dir/path/ -name .svn -exec rm -rf '{}' \;
cp -ruv /source/dir/path/* /destination/dir/path/
done
問題是前兩個命令運作良好,但在執行(成功)“find -exec”命令後進程被終止。有什麼想法嗎?
順便說一句-如果我刪除“find -exec”,一切都會順利。
答案1
試試這個(注意!)
dir1=/source/dir/path/
while ! inotifywait -qqre modify "$dir1"; do
rm -r /destination/dir/path
find /source/dir/path/ -name .svn -exec rm -rf '{}' \;
cp -ruv /source/dir/path/* /destination/dir/path/
done