Advertisement
tolikpunkoff

countdown on bash

Mar 11th, 2015
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.41 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. WTIMEOUT=10 #vremya ozhidaniya
  4.  
  5. while [ $WTIMEOUT -ge 0 ];do
  6.     tput sc #zapominaem poziciu kursora
  7.     printf '%3s' $WTIMEOUT  #vivodim znachenie peremrnnoi
  8.                 #(3 - chislo probelov, esli stroka menshe 3 simvolov
  9.                 #to nedostajushie simvoly v nachale stroki budut
  10.                 #probely)
  11.     tput rc #ustanavlivaem kursor na staroe mesto
  12.     sleep 1
  13.     let "WTIMEOUT=WTIMEOUT-1"
  14. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement