Last active
February 24, 2021 23:21
-
-
Save husobee/b73302dd1b1a277273e5 to your computer and use it in GitHub Desktop.
fun beginnings of a bash progress bar
This file contains 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
#!/bin/bash | |
function progress { | |
cattail='=' | |
cat1=' ,------, ' | |
cat2=' | /\_/\ ' | |
cat3=' |__( ^ .^) ' | |
cat4=' "" "" ' | |
echo;echo;echo;echo;echo;echo | |
((line1 = $(tput lines) - 6)) | |
((line2 = line1 + 1)) | |
((line3 = line2 + 1)) | |
((line4 = line3 + 1)) | |
((curcol = 1)) | |
((coldir = 1)) | |
((COLS=$(tput cols)-13)) | |
((COUNT = 0)) | |
while [ $COUNT -lt $COLS ]; do | |
((COUNT+=1)) | |
cattail="$cattail=" | |
tput cup $line1 1 ; printf "\e[0;31m$cattail\e[0m$cat1\n" | |
tput cup $line2 1 ; printf "\e[0;33m$cattail\e[0m$cat2\n" | |
tput cup $line3 1 ; printf "\e[0;36m$cattail\e[0m$cat3\n" | |
tput cup $line4 1 ; printf "\e[0;34m$cattail\e[0m$cat4\n" | |
((curcol = curcol + coldir)) | |
sleep 0.05 | |
done | |
return 0 | |
} | |
progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment