Skip to content

Instantly share code, notes, and snippets.

@arjan
Created June 9, 2020 13:22
Show Gist options
  • Save arjan/e790691f82be3e701dccf489c0ef69bb to your computer and use it in GitHub Desktop.
Save arjan/e790691f82be3e701dccf489c0ef69bb to your computer and use it in GitHub Desktop.
#!/bin/bash
EXCLUDE='(logs|\.git|\.log|appsignal_extension.so|.compile.protocols|.compile.elixir|flymake|\.#)'
if [ "$1" = "--" ]; then
DOARG=1
shift
fi
$@
while FILES=$(inotifywait -qre close_write --exclude "$EXCLUDE" --format "%w%f" .)
do
echo "Files changed: $FILES"
sleep .5
if [ "$DOARG" = "1" ]; then
echo -n " running '$@ $FILES' ..."
$@ "$FILES"
else
echo -n " running '$@' ..."
$@
fi
echo "OK"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment