使inotifywait注意符号链接

时间:2011-10-17 18:46:19

标签: linux shell filesystemwatcher

我正在寻找一种方法来通知层次结构进行修改,但我有符号链接,我希望每个符号链接都指向修改后的文件。

一个技巧可以是使用查找找到它们但我更喜欢更清洁的东西:)

1 个答案:

答案 0 :(得分:0)

我来到这样的东西,它有效,但我不喜欢它:

for f in $(find -L $SOURCE_DIR -samefile "$folder$file")
do
    if [ -L "$f" ]
    then
        do_something_with_the_link $(dirname "$f")/ $(basename "$f")
    fi
done