Skip to content

Instantly share code, notes, and snippets.

@husobee
Last active February 24, 2021 23:21
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save husobee/b73302dd1b1a277273e5 to your computer and use it in GitHub Desktop.
fun beginnings of a bash progress bar
#!/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
@husobee
Copy link
Author

husobee commented Feb 2, 2016

 ======================================================================== ,------,   
 ======================================================================== |   /\_/\  
 ======================================================================== |__( ^ .^) 
 ======================================================================== ""   ""    
^C

@Miyayes
Copy link

Miyayes commented Feb 24, 2021

Holy cannoli!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment