Skip to content

Instantly share code, notes, and snippets.

@ggreer
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggreer/9162181 to your computer and use it in GitHub Desktop.
Save ggreer/9162181 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ $# -lt 2 ]
then
echo "Usage: $0 path command"
exit 1
fi
WATCH_PATH="$1"
shift
COMMAND=("$@")
echo "Watching $WATCH_PATH"
while true
do
inotifywait "$WATCH_PATH"
echo "Running ${COMMAND[@]}"
"${COMMAND[@]}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment