After some googling, I found the entr utility to run a command on a file update. I can get it working, but unfortunately, I'm unable to exit from it.
The literature about it isn't much and quite vague for me. I'd need a behaviour, like
- detect file change
- run my command (setting a VAR in the caller script)
- exit
But not sure how to achive this. Calling entr seems to be an infinite loop, it's running endlessly.
It's rather strange I couldn't find any similar usecases. (https://github.com/eradman/entr)
Should I start playing with the inotifywait from inotify-tools package?