Last active
April 5, 2023 09:45
-
-
Save bwhmather/2a8f74964b31bac4c5836970374d4bf4 to your computer and use it in GitHub Desktop.
Restart a process when a command changes in the current directory
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
#!/usr/bin/sh | |
while true; do | |
reset; | |
"$@" & | |
PID=$!; | |
inotifywait -e MODIFY --recursive .; | |
kill $PID; | |
wait $PID; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment