Skip to content

Instantly share code, notes, and snippets.

@Intey
Created December 11, 2016 11:45
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 Intey/aa46d35b6c1f954c17c4be46bbbf018c to your computer and use it in GitHub Desktop.
Save Intey/aa46d35b6c1f954c17c4be46bbbf018c to your computer and use it in GitHub Desktop.
wait file change and execute
#!/bin/bash
file=$1
shift
let changed=0
while [[ $changed -eq 0 ]]; do
inotifywait -e CLOSE_WRITE $file -qo /dev/null && changed=$?
echo "update with: $@"
$@
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment