From 77cfffee6177fb0421fa0fce15d6a1875bde4816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20W=C3=BChrer?= Date: Sat, 18 May 2024 21:04:34 +0200 Subject: manuals, sum-down, radix --- bin/countdown | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/countdown (limited to 'bin/countdown') diff --git a/bin/countdown b/bin/countdown new file mode 100755 index 0000000..59daf56 --- /dev/null +++ b/bin/countdown @@ -0,0 +1,23 @@ +#!/bin/bash + +declare -i t=$1 + +while [ $((t--)) -ne 0 ]; do + if [ $t -gt 5400 ]; then + h=$((t/3600)) + m=$(((t-(h*3600))/60)) + if [ $m -lt 10 ]; then m=0$m; fi + s=$((t%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$h:$m:$s " + elif [ $t -gt 90 ]; then + m=$((t/60)) + s=$((t%60)) + if [ $s -lt 10 ]; then s=0$s; fi + echo -en "\r$m:$s " + else + echo -en "\r$t " + fi + sleep 1 +done +echo -en "\r" -- cgit v1.2.3