Making simple CountDown program in Bash

Count-down script without user interaction:


#!/bin/bash
row=5
column=10
tput clear
for i in {30..00..00}
 do tput cup $row $column
 echo -e -n "Launch in: $i\n\n"
 sleep .1
done
echo -e 'Done!\n\n'


syntax to run this script: /path/to/countdown_auto.sh

------------------------------------------------------

Count-down script with user interaction:


#!/bin/bash
row=5
column=10
max=$1
min=$2
interval=$3
if [ $# -ne 3 ]
then
    echo -e "Syntax is $0 <countdown starting value> <countdown ending value> <counting interval>"
else
    tput clear
    for i in `eval "echo {$max..$min..$interval}"`
    #for i in {20..01..2}
      do tput cup $row $column
      echo -e -n "Launch in: $i\n\n"
      sleep .1
    done
    echo -e 'Done!\n\n'
fi


syntax to run this script: /path/to/countdown.sh <countdown starting value> <countdown ending value> <counting interval>



Comments

Popular posts from this blog

yum failed 6 times. Cannot continue!

Resolved: DOCKER: Error response from daemon: Could not attach to network / rpc error: code = 7 desc = network not manually attachable.

unexpectedly shrunk window (repaired) in dmesg log - TCP Peer