Last active
March 9, 2021 01:23
-
-
Save thewrongjames/011111f26442606876b3d9fab03af5f0 to your computer and use it in GitHub Desktop.
Run make when any files passed as arguments are modified.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
description="Run make when any files passed as arguments are modified." | |
usage="Usage: makeonfilechange [files]" | |
if [ $# = 0 ]; then | |
echo $description | |
echo $usage | |
exit 1 | |
fi | |
# Separate if statement becuase if $# = 0 then $1 evaluates to nothing and the | |
# test command errors because it gets an invalid number of arguments. | |
if [ $1 = --help -o $1 = -h ]; then | |
echo $description | |
echo $usage | |
exit 1 | |
fi | |
while inotifywait -e modify $@; do | |
make | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment