bashTimeUtils/timer

32 lines
302 B
Bash
Executable File

#! /bin/sh
if [[ $# -ne 1 ]]
then
echo "USAGE: timer <number>"
exit 10
fi
if [[ $1 =~ 'help' ]]
then
echo "Timer : timer <n sec>"
exit 0
fi
if [[ $1 -le 0 ]]
then
echo "The argument must be greater than 0"
exit 11
fi
for ((i=$1;i>=0;i--))
do
sleep 1
clear
echo $i
done
read
clear
exit 0