mirror of https://github.com/rwxrob/dot
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
298 B
Plaintext
16 lines
298 B
Plaintext
3 years ago
|
#!/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 "$@"
|