Command & Development/Shell Script

[Shell Script] Progress Bar

Richard.Ryu 2022. 9. 22. 16:43
반응형

Backup & Recovery Shell Script를 만들다가, Progress Bar를 구현해봤습니다.

 

#!/bin/bash
echo "##############################"
echo " Backup & Recovery Shell"
echo "##############################"
date

read num
if [ $num == 1 ]
        then
        echo "------------------"
        echo "Backup Starting "
        echo "------------------"
        echo -ne "[#                    ]\r"
        sleep 1
        echo -ne "[#####                ]\r"
        sleep 1
        echo -ne "[##########           ]\r"
        sleep 1
        echo -ne "[###############      ]\r"
        sleep 1
        echo -ne "[#####################]\r"
        sleep 1
        echo -e "\n"
        echo "Backup Complete!!!"

elif [ $num == 2 ]
        then
        echo "------------------"
        echo "Recovery Starting"
        echo "------------------"
        echo -ne "[#                    ]\r"
        sleep 1
        echo -ne "[#####                ]\r"
        sleep 1
        echo -ne "[##########           ]\r"
        sleep 1
        echo -ne "[###############      ]\r"
        sleep 1
        echo -ne "[#####################]\r"
        sleep 1
        echo -e "\n"
        echo "Recovery Complete!!!"

else
        echo "Please Typed Correct Number"
        echo "#######None Action########"
fi

 

반응형