Skip to content

Instantly share code, notes, and snippets.

@bwhmather
Last active April 5, 2023 09:45
Show Gist options
  • Save bwhmather/2a8f74964b31bac4c5836970374d4bf4 to your computer and use it in GitHub Desktop.
Save bwhmather/2a8f74964b31bac4c5836970374d4bf4 to your computer and use it in GitHub Desktop.
Restart a process when a command changes in the current directory
#!/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