Skip to content

Instantly share code, notes, and snippets.

@t1anchen
Last active August 29, 2015 13:56
Show Gist options
  • Save t1anchen/9035903 to your computer and use it in GitHub Desktop.
Save t1anchen/9035903 to your computer and use it in GitHub Desktop.
Timer
#!/bin/sh
read -p "Play? " op
while [ "$op" != "n" ]
do
touch timerflag1
echo "Started ..."
read -p "Finished? " op
MYT1=`date -r timerflag1 +%s 2>/dev/null`
MYT2=`date +%s`
printf "You've spent "
date +%T -u -d @$(($MYT2-$MYT1))
read -p "Play again? " op
done
rm -f timerflag1
echo "Bye."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment