Simple bash countdown timer


Here is a simple bash countdown timer, to run you just enter the minutes you want this to run for, i.e “./count.sh 10” will run countdown for 10 minutes.



#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 MIN (example: $0 1)";
exit 1;
fi

TIME=$(($1*60))
CUR=$TIME

while [ $CUR -gt 0 ]
do
 CUR=$(($CUR - 1))
 clear
 echo $CUR
 sleep 1
done

echo "!!!FINISHED!!!"

, , , , ,

Comments are closed.