In a bash script I want to check if a file has been changed within the last 2 minutes.
I already found out that I can access the date of the last modification with <
Here's an even simpler version that uses shell math over expr:
SECONDS (for idea)
echo $(( $(date +%s) - $(stat file.txt -c %Y) ))
MINUTES (for answer)
echo $(( ($(date +%s) - $(stat file.txt -c %Y)) / 60 ))
HOURS
echo $(( ($(date +%s) - $(stat file.txt -c %Y)) / 3600 ))