dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

timer (365B)


      1 #!/bin/sh
      2 
      3 timeout="$1";
      4 
      5 case "$timeout" in
      6 ''|*[!0-9]*)
      7 	echo "usage: timer SECONDS"
      8 	;;
      9 *)
     10 	while [ "$timeout" != "0" ]; do
     11 		printf '\b\b\b\b\b\b\b\b'
     12 		printf '%02d:%02d:%02d'   \
     13 		"$((timeout/3600))"     \
     14 		"$((timeout/60))"       \
     15 		"$((timeout % 60))";
     16 
     17 		timeout="$((timeout-1))";
     18 		sleep 1;
     19 	done
     20 	;;
     21 esac
     22 printf '\b\b\b\b\b\b\b\b'
     23 printf '00:00:00\n'