Created
January 21, 2020 20:09
-
-
Save rickycodes/44010570b08a1c853d102f7bec182648 to your computer and use it in GitHub Desktop.
countdown alias
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage `countdown seconds` eg: `countdown 10` `countdown 60*15` etc. | |
countdown() { | |
_date=$((`date +%s` + $1)); | |
while [ "$_date" -ge `date +%s` ]; do | |
echo -ne "$(date -u --date @$(($_date - `date +%s`)) +%H:%M:%S)\r"; | |
sleep 0.1 | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment