The (command line) interface I have in mind is like so:
watching FILE+ do COMMAND [ARGS] (and COMMAND [ARGS])*
Where any occurrence of ‘{}‘ in COMMAND is replaced with the name of the file that changed. And note that ‘do‘ and ‘and‘ are keywords.
For example:
> watching foo.txt bar.txt do scp {} somewhere.com:. and echo moved {} to somewhere
Or:
> watching foo.c do gcc foo.c and ./a.out
I’m not wedded to that interface though. I’ll add my script that does that as an answer and see if anyone has anything better or ways to improve it.
1 Answer