mirror of
https://github.com/rwxrob/dot
synced 2024-11-18 15:25:52 +00:00
16 lines
298 B
Bash
Executable File
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 "$@"
|