From 829579ca907214221093fef802a643f4257aa5c5 Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Mon, 13 Feb 2023 02:29:06 -0600 Subject: [PATCH] Added countdown timer --- .bash_aliases | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bash_aliases b/.bash_aliases index 7f848f0..921fc0b 100755 --- a/.bash_aliases +++ b/.bash_aliases @@ -86,3 +86,13 @@ alias tootctl='docker exec -it -w /app/www mastodon bin/tootctl' alias hackingtool='docker run -it --net=host --privileged vgpastor/hackingtool' # Do you need to reboot? Find out here! alias needrs='[ -f /var/run/reboot-required ] && echo "You need to reboot"' + +# Countdown Timer +countdown() { + start="$(( $(date '+%s') + $1))" + while [ $start -ge $(date +%s) ]; do + time="$(( $start - $(date +%s) ))" + printf '%s\r' "$(date -u -d "@$time" +%H:%M:%S)" + sleep 0.1 + done +}