I'm looking for a way to monitor a file and trigger an event as soon the file was removed. Once it is removed I will replace/copy a new file and start the monitor again.
watch "/tmp/fileToMonitor.txt" // file deleted by some process cp new_file "/tmp/fileToMonitor.tx" // watch file again (repeat same steps..)
How can I do that with a bash script? Is this possible?