-
-
Save shimarin/3ce1ae1a244a923aa2dc868ddce8c677 to your computer and use it in GitHub Desktop.
script to get file age(seconds from mtime)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$#" -eq 0 ] ; then | |
echo "Usage: $0 file" 1>&2 | |
exit 1 | |
fi | |
if [ ! -e $1 ];then | |
echo 9223372036854775807 | |
exit 1 | |
fi | |
CURRENT=`date +%s` | |
MTIME=`stat -c %Y $1` | |
echo $(( $CURRENT - $MTIME )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment