#!/bin/bash# #下面是字体输出颜色及终端格式控制 # Font Color 30-37ECHO-E "\033[30m black word \033[0m" echo-e "\033[31m red word \033[0m" echo-e "\033[32m green word \ 033[0m "echo-e" \033[33m yellow word \033[0m "echo-e" \033[34m blue word \033[0m "echo-e" \033[35m purple word \033[0m "echo-e" \033[36m sky blue Word \033[0m "Echo-e" \033[37m white word \033[0m "#字背景颜色范围: 40-47echo-e" \033[40;37m black background \033[0m "ECHO-E" \033[41;30m red Bottom black word \033[0m "echo-e" \ 033[42;34m Green Bottom Blue character \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 black word \033[ 0m "Echo-e" \033[46;30m Blue bottom black character \033[0m "echo-e" \033[47;34m white bottom Blue word \033[0m "# ... #控制选项说明 #\033[0m close all properties #\033[1m set high Brightness #\033[ 4m underline echo-e "\033[4;31m underline red character \033[0m" #闪烁echo-E "\033[5;34m red word flashing \033[0m" #反影echo-E "\033[8m blanking \033[0m" ##\033[30m-\033 [37m set foreground color #\033[40m-\033[47m set background #\033[na cursor up n rows #\033[nb cursor down n rows echo-e "\033[4a cursor up 4 lines \033[0m" #\033[nc cursor right shift n rows #\033[ nd cursor left n line #\033[y;xh set cursor position #\033[2j Clear Screen #\033[k clear the contents from cursor to end of line ECHO-E "\033[k clear cursor to end of line \033[0m" #\033[s save cursor position #\033[u restore cursor position # \033[?25| Hide cursor #\033[?25h display cursor ECHO-E "\033[?25l hide cursor \033[0m" ECHO-E "\033[?25h show cursor \033[0m "#下面的这个例子是字体不停的闪烁. #!/bin/bash#a=30b=41while truedoecho-e "\033[${a}m shining Girl \033[0m" Echo-e "\033[${a}m, West Asia \033[0m" Echo-e "\033[${a}m Rockwell \033[0m "a=$ (($ ($a%7) +30)) b=$ (($ (($b%7) +40)) #每次让字体颜色在30-37 Conversion # Each time you let the background color in 40-47 convert echo-e" \033[4a\033[0m "done
Shell script programming (strict terminal format control, beautiful output font color)