Você pode tentar um script de shell (chame-o de timer.sh
) assim:
. timer.val
case "$1" in
start)
echo $TIMERSTART
echo "TIMERSTART='date +%s'" > timer.val
echo $TIMERSTART
;;
stop)
echo $TIMERSTART
TIMEREND='date +%s'
echo $TIMEREND
let RESULT=$TIMEREND-$TIMERSTART
echo $RESULT
;;
*)
echo "no command"
esac