Bash: Check if file was modified since used in script
- by Thomas Münz
I need to check in a script if a file was modified since I read it (another application can modify it in between). According to bash manual there is a "-N" test which should report if a file was modified since last read. I tried it in a small script but it seems like it doesn't work.
#!/bin/bash
file="test.txt"
echo "test" > $file
cat $file;
if…