Bashrc.wiki: removed code from countdown section. Just read the source
This commit is contained in:
parent
2ff12a87e5
commit
6eb0f3d487
20
Bashrc.wiki
20
Bashrc.wiki
|
@ -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.
|
||||
|
||||
{{{class="prettyprint"
|
||||
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.
|
||||
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.
|
||||
|
||||
----
|
||||
|
||||
|
|
Loading…
Reference in New Issue