dotfiles/.bin/timer

12 lines
256 B
Plaintext
Raw Normal View History

#!/bin/sh
case $1 in
stop) rm -f /tmp/timer.txt \
&& echo stopped
;;
*) [ -f /tmp/timer.txt ] \
&& echo $(( $(date +%s) - $(</tmp/timer.txt) )) \
|| ( date +%s > /tmp/timer.txt && echo started )
;;
esac