Skip to content

Instantly share code, notes, and snippets.

@emk
Created December 3, 2010 21:53
Show Gist options
  • Save emk/727621 to your computer and use it in GitHub Desktop.
Save emk/727621 to your computer and use it in GitHub Desktop.
Rerun a command automatically whenever files in a directory change
#!/bin/bash
#
# Usage: find . -name \*.hs | rerun make
#
# Install inotifywait using 'sudo apt-get install inotify-tools' or whatever.
#
# Automatically re-run a command when a file changes. Assumes that your
# text editor closes files after each write. Pipe file names on standard
# input.
inotifywait --fromfile - --monitor --quiet --event close_write | \
while read; do "$@"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment