Skip to content

Instantly share code, notes, and snippets.

@tonyg
Created November 7, 2018 12:25
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 tonyg/e7ada20b18ab0b86011e3dba10f409bf to your computer and use it in GitHub Desktop.
Save tonyg/e7ada20b18ab0b86011e3dba10f409bf to your computer and use it in GitHub Desktop.
Simple inotify-based watcher/rebuilder - e.g. 'inotifytest make foo' or 'inotifytest redo'
#!/bin/bash
# Heavily cut-down inotifymake
# Copyright © 2011 Mega Nerd, Pty Ltd
# Copyright © 2011-2012 Operational Dynamics Consulting, Pty Ltd
# Copyright © 2016 Tony Garnock-Jones
#
# The code in this file, and the program it is a part of, is made available
# to you by its authors as open source software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License version
# 2 ("GPL") as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more details.
#
# You should have received a copy of the GPL along with this program. If not,
# see http://www.gnu.org/licenses/. The authors of this program may be
# contacted through http://research.operationaldynamics.com/
while true
do
clear
"$@"
inotifywait -q -q -r -e 'close_write' \
--exclude '^\..*\.sw[px]*$|4913|~$|.git/.*\.lock$|.*i\.log$' .
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment