Recently just learned the shell script programming method, uses the shell script to implement a colored progress bar, below will show the result to everybody.
Program Results
This is really very simple to achieve, only need to understand some basic syntax on it. The implementation of the progress bar is the loop plus output format control can be realized, this point you can understand the code, I am here to explain how the following color is set, in addition to the above colors you can also configure their favorite colors.
Output format with color
Color related commands
Reset properties to default setting
1 set bold 2 to
set half brightness (analog color display color)
4 set Underline (analog color display color)
5 Set flashing
7 Set reverse image
8 fade
22 Set general density
24 off underline
25 off flashing
27 off reverse image
/font color range (foreground): 30~39
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark green
37: White
38: Underline the default foreground color
39: Close the Underline
//Word background color range on the default foreground color (background color ): 40~49
40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark green
47: White
NA cursor up n line
NB cursor down n line
nC cursor right move n line
ND cursor left n line
y;xh set cursor position 2J clear
screen
K clear from cursor to end of line
s save cursor position
u Restore cursor position
? 25l hidden cursor
? 25h display cursor
To display colors by using a combination of commands
Echo-e "\033[0m None \033[0m" Echo-e "\033[30m black \033[0m" echo-e "\033[1;30m" Dark_gray \033[0m "echo-e" \033[0;34m " Blue \033[0m "Echo-e" \033[1;34m light_blue \033[0m "echo-e" \033[0;32m Green \033[0m "Echo-e" \033[1;32m Light_green \033[0m "Echo-e" \033[0;36m cyan \033[0m "echo-e" \033[1;36m Light_cyan \033[0m "echo-e" \033[0;31m red \033[0m "echo -E "\033[1;31m light_red \033[0m" echo-e "\033[0;35m purple \033[0m" Echo-e "\033[1;35m light_purple \033[0m" Echo-e "\ 033[0;33m Brown \033[0m "echo-e \033[1;33m yellow \033[0m" echo-e "\033[0;37m light_gray \033[0m" Echo-e "\033[1;37m W Hite \033[0m "Echo-e" \033[0m none \033[0m "Echo-e" \033[0m none \033[0m "Echo-e" \033[0m none \033[0m "Echo-e" \033[0 M none \033[0m "Echo-e" \033[0m none \033[0m "Echo-e" \033[40;37m black background white text \033[0m "Echo-e" \033[41;30m red Bottom black word \033[0m "echo -E "\033[42;34m green bottom Blue word \033[0m" echo-e "\033[43;34m yellow bottom Blue word \033[0m" echo-e "\033[44;30m Blue bottom Black word \033[0m" echo-e "\033[45;30m Purple bottom Black word \033[0m "echo-e" \033[46;30m Blue Bottom Black word \033[0m "echo-e" \033[47;34m white bottom Blue word \033[0m "echo-e" \033[4;31m underline the red word \033[0m "echo-e" \033[5;31m the Scarlet Letter is flashing \033[0m "Echo-e" \033[8m hidden \033[0m "
Program Results