]> git.donarmstrong.com Git - bin.git/blob - run_when_changed
add git-hogs command
[bin.git] / run_when_changed
1 #!/bin/sh
2
3 WATCH_FILE="$1"
4 shift 1;
5
6 WATCH_DIR=`dirname "$WATCH_FILE"`
7 WATCH_FILE=`basename "$WATCH_FILE"`
8
9 inotifywait -m -e close_write,moved_to,create $WATCH_DIR |
10     while read -r directory events filename; do
11         if [ "x$filename" = "x$WATCH_FILE" ]; then
12             ( exec "$@" );
13         fi;
14     done;