Bashrc.wiki: removed code from countdown section. Just read the source

This commit is contained in:
David Thurstenson 2021-06-05 18:29:27 -05:00
parent 2ff12a87e5
commit 6eb0f3d487
1 changed files with 1 additions and 19 deletions

View File

@ -121,25 +121,7 @@ https://git.thurstylark.com/vcsh/bashrc.git/tree/.bashrc.d/countdown.bash
Found this little function when I wanted to add functionality to `shot()`. It takes an integer as an argument, then counts down that number of seconds visually. Found this little function when I wanted to add functionality to `shot()`. It takes an integer as an argument, then counts down that number of seconds visually.
{{{class="prettyprint" I no longer use `countdown()` from `shot()` directly, but sometimes will in some sort of pipeline in tandem with it. I found that I want that flexibility out in the open for me to use instead of packed behind a bespoke ui for little benefit.
countdown() {
if [ -z "$1" ]; then
printf "
countdown: Count down while printing progress on the terminal
Usage: countdown <seconds>
"
fi
local secs="$1"
while [ "$secs" -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
}
}}}
This probably isn't the sanest or safest solution to the problem, but it gets the job done. Patches welcome.
---- ----