file-age now BSD compatible
This commit is contained in:
@@ -23,7 +23,10 @@ STATFILE="$1"
|
|||||||
test -e "$STATFILE" || { echo File "$STATFILE" does not exist >&2; exit 1; }
|
test -e "$STATFILE" || { echo File "$STATFILE" does not exist >&2; exit 1; }
|
||||||
|
|
||||||
UNITS=${2:-S}
|
UNITS=${2:-S}
|
||||||
created=$( stat -c %Y "$STATFILE" )
|
case $OSTYPE in
|
||||||
|
darwin*) created=$( stat -f %c -t %s "$STATFILE" ) ;;
|
||||||
|
linux*) created=$( stat -c %Y "$STATFILE" ) ;;
|
||||||
|
esac
|
||||||
now=$( date +%s )
|
now=$( date +%s )
|
||||||
age=$(( $now - $created ))
|
age=$(( $now - $created ))
|
||||||
|
|
||||||
|
|||||||
2
rc
2
rc
@@ -1,6 +1,6 @@
|
|||||||
# source me to enable tools
|
# source me to enable tools
|
||||||
|
|
||||||
TOOLSPATH=$( readlink -f $( dirname "$BASH_SOURCE" ) )
|
TOOLSPATH=$( realpath $( dirname "$BASH_SOURCE" ) )
|
||||||
|
|
||||||
PATH=$PATH:"$TOOLSPATH"/bin
|
PATH=$PATH:"$TOOLSPATH"/bin
|
||||||
[[ "$1" = "-f" ]] && PATH="$TOOLSPATH"/bin:$PATH
|
[[ "$1" = "-f" ]] && PATH="$TOOLSPATH"/bin:$PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user