How do I get the filename from inotifywait events?
The cleaner way is illustrated in this blog entry:
inotifywait -m -r -q --format '%w' bootstrap/ | while read FILE
do
echo "something happened on path $FILE"
done
Turns out I just needed to restructure the while
so that I captured the output of inotifywait
:
while true; do
echo "something happened"
filename=$(inotifywait -r -q --format %w bootstrap/)
[[ $filename == *.js ]] && uglifyjs .....
[[ $filename == *.less ]] && lessc bootstrap.less
done
I'm still curious to know if there are cleaner ways of doing this.