Permalink
Browse files

Adding simple inotifywait wrapper

  • Loading branch information...
weikinhuang committed Mar 26, 2013
1 parent 132956a commit 8ea50d7c52d009decc642214e611040611d31d0d
Showing with 29 additions and 0 deletions.
  1. +13 −0 .dotenv/cygwin/bin/fswatch
  2. +16 −0 .dotenv/linux/bin/fswatch
View
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+DIRECTORY="$(cygpath -w "${1}")"
+TARGETDIR="$(cygpath -u "${DIRECTORY}")"
+shift
+
+inotifywait -mrq --format '%e %w %f' \
+"$DIRECTORY" \
+| \
+while read event path file; do
+ cd "$TARGETDIR"
+ "$@"
+done
View
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+DIRECTORY="$(readlink -f "${1}")"
+shift
+
+inotifywait -mrs --timefmt '%s' --format '%T %e %w %f' \
+--event modify \
+--event move \
+--event create \
+--event delete \
+"$DIRECTORY" \
+| \
+while read time event dir file; do
+ cd "$DIRECTORY"
+ "$@"
+done

0 comments on commit 8ea50d7

Please sign in to comment.