我刚刚学会了如何不断检查文件是否被修改:
while inotifywait -q -e modify filename >/dev/null; do
echo "filename is changed"
# do whatever else you need to do
done
如果我使用目录名而不是文件名,我可以检查目录的所有文件:
while inotifywait -q -e modify directoryname >/dev/null; do
echo "filename is changed"
# do whatever else you need to do
done
但是我怎样才能知道echo
已更改文件的文件名?