bookmark

Display runnning countdown in a bash script? - The UNIX and Linux Forums


Description

countdown() ( IFS=: set -- $* secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} )) while [ $secs -gt 0 ] do sleep 1 & printf "\r%02d:%02d:%02d" $((secs/3600)) $(( (secs/60)%60)) $((secs%60)) secs=$(( $secs - 1 )) wait done echo )

Preview

Tags

Users

  • @jakspa

Comments and Reviews