rwxrob-dot/scripts/ageof
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

16 lines
298 B
Bash
Executable File

#!/usr/bin/env bash
# Outputs the seconds since the thing identified by the first argument
# was last modified (not created).
ageof() {
local path="$1"
if [[ -z "$path" ]]; then
echo 'usage: ageof <path>'
return 1
fi
echo $(( $(date +%s) - $(date -r "$path" +%s) ))
}
ageof "$@"