Detailed explanation of echo command

Basic command learning directory

shellIn the script, echo shows the content with color display, echo display with color, and needs parameter -e.
The format is as follows:

echo -e "\033[Word background color; text color M string \033[0m "

For example:

echo -e "\033[41;36m something here \033[0m"

41 of the positions represent the background color, and 36 of the positions represent the colors of the characters.
Note:
1、The word background color and text color are in English.
2、There is a m behind the text color.
3、There is no space before and after the string, and if so, the output is also blank.
Here are the corresponding words and background colors. You can try to find out different colors.
Example

echo -e “\033[31m Red word \033[0m "Echo -e "\033[34m yellow word \033[0m"Echo -e "\033[41; 33m red bottom yellow character \033[0m"Echo -e "\033[41; 37m red bottom white word \033[0m "

Leave a Reply

Your email address will not be published. Required fields are marked *