time_since_mod
# # Returns the time since the file was last modified, in # minutes. Intended for giving to find -mmin, possibly like # this: # # find somedir/ \ # -mmin -$(($(time_since_mod somefile) + 10)) \ # -mmin +$(($(time_since_mod somefile) - 10)) \ # # This would give a 20 second range based around mtime of # `somefile'. require field time_since_mod () { echo $(( ( $(date +%s) - $(stat --format=%Y "$1") ) / 60 )) } # vim:syn=sh:ft=sh