Shell script programming (strict terminal format control, beautiful output font color), shell script Programming
#! /Bin/bash # font output color and terminal format control # font color 30-37echo-e "\ 033 [30 m black character \ 033 [0 m" echo-e "\ 033 [31 m red word \ 033 [0 m "echo-e" \ 033 [32 m green word \ 033 [0 m "echo-e" \ 033 [33m yellow word \ 033 [0 m "echo-e" \ 033 [34m Blue Word \ 033 [0 m "echo-e" \ 033 [35m purple word \ 033 [0 m "echo-e" \ 033 [36m day blue word \ 033 [0 m "echo-e" \ 033 [37m white word \ 033 [0 m "# Word background color range: 40-47echo-e "\ 033 [40; 37m black white \ 033 [0 m" echo-e "\ 033 [41; 30 m black text \ 033 [0 m "echo-e" \ 033 [42; 34 m green background Blue Word \ 033 [0 m "echo-e" \ 033 [43; 34m yellow bottom blue letter \ 033 [0 m "Echo-e" \ 033 [44; 30 m blue background black letter \ 033 [0 m "echo-e" \ 033 [45; 30 m black text \ 033 [0 m "echo-e" \ 033 [46; 30 m black text \ 033 [0 m "echo-e" \ 033 [47; 34m white background blue \ 033 [0 m "#..... # control option description # \ 033 [0 m disable all attributes # \ 033 [1 m set high brightness # \ 033 [4 m underline echo-e "\ 033 [4; 31m underline red letter \ 033 [0 m "# Flashing echo-e" \ 033 [5; the 34m red letter flashes at \ 033 [0 m "# Shadow echo-e" \ 033 [8 m blanking \ 033 [0 m "##\ 033 [30 m-\ 033 [37m settings foreground color # \ 033 [40 m-\ 033 [47m Set background color # \ 033 [nA cursor up n rows # \ 033 [nB cursor down n rows echo-e "\ 033 [4A move cursor up 4 rows \ 033 [0 m "# \ 033 [move nC cursor right n rows # \ 0 33 [nD cursor shifts n rows left # \ 033 [y; xH set the cursor position # \ 033 [2J clear screen # \ 033 [K clear content from the cursor to the end of the line echo-e "\ 033 [K clear content from the cursor to the end of the line \ 033 [0 m "# \ 033 [s Save the cursor position # \ 033 [u restore the cursor position # \ 033 [? 25 | hide the cursor # \ 033 [? 25 h show the cursor echo-e "\ 033 [? 25l hide the cursor \ 033 [0 m "echo-e" \ 033 [? 25 h show the cursor \ 033 [0 m "# In the following example, the font flashes continuously. #! /Bin/bash # a = 30b = 41 while truedoecho-e "\ 033 [$ {a} m glorious girl \ 033 [0 m" echo-e "\ 033 [$ {a} m? West Asia \ 033 [0 m "echo-e" \ 033 [$ {a} m locksass \ 033 [0 m "a =$ ($ (( $ a % 7 )) + 30) B = $ ($ B % 7) + 40 )) # converting the font color to 30-37 at a time # converting the background color to 40-47 at a time echo-e "\ 033 [4A \ 033 [0 m" done