I didn't know of entr, or inotify at the time. Years ago, I wrote a script that did mostly that, but I've found myself to instead more often use a different script to rerun things based on manually triggered global hotkeys. It scratches a different itch, but in case you want to check it out:
https://github.com/swarminglogic/shell-scripts/blob/master/r...In short, you set up a global hotkey to trigger the rerun of a "key"-ed command. Then you can quickly run a command, which can be rerun with that hotkey.
So, a global hotkey set up for `runrerun -r foo`
Then in a terminal you can use `runrerun -b foo -- <COMMAND>`.
It is a bit over-engineered with multiple sessions, different kill signals for restarts, etc. But that's the gist of it.