The echo -e command is used to change the term color
echo -e "\E[40;32m\b\c"
#Changes the term color to green with black background
#!/bin/bash
function success_banner()
{
echo -e "\E[40;32m\b\c"
echo -e "[OK]"
echo -e "\E[40;37m"
}
function progress_banner()
{
echo ""
echo "##############################################################"
echo ""
echo -e "Step: $1 \b\c"
}
function rotate_line(){
INTERVAL=1
timecount="0"
while :
do
timecount=`expr $timecount + 1`
case $timecount in
"1")
echo -e "-\b\c"
sleep $INTERVAL
;;
"2")
echo -e '\\'"\b\c"
sleep $INTERVAL
;;
"3")
echo -e "|\b\c"
sleep $INTERVAL
;;
"4")
echo -e "/\b\c"
sleep $INTERVAL
;;
*)
timecount="0" # Reset the count to 0
esac
done
}
function start_rotation(){
rotate_line &
}
function stop_rotation(){
rotate_line_pid=$!
kill -9 $rotate_line_pid
echo -e "\b\b\b"
}
progress_banner Rotation_Bar_Started
start_rotation
sleep 5
stop_rotation
success_banner Ok
Read more ...