How to make a text blink in shell script

前端 未结 4 1765
孤街浪徒
孤街浪徒 2021-02-02 10:57

I have this piece of code below:

echo \" \\033[33mTitle of the Program\\033[0m\"

which changes the colour to yellow.

How can I make the text

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 11:45

    Try adding -e if it's not working without it

    You may need to add the -e option to echo (at least that's required on all or most systems I use). The following will tell your system to blink the text:

    echo  -e "\033[5mTitle of the Program\033[0m"
    

    You can have blinking and color

    And you don't have to choose either yellow or blinking. You can have your cake and eat it too:

    echo  -e "\033[33;5mTitle of the Program\033[0m"
    

    Some systems ignore blink codes

    Your system may ignore the blink code—this appears to be quite common. If you want to make the text prominent, but blinking is being ignored, you can instead invert the colors with 7:

    echo  -e "\033[33;7mTitle of the Program\033[0m"
    

    Or you can use blinking and inversion of colors (and yellow):

    echo  -e "\033[33;5;7mTitle of the Program\033[0m"
    

提交回复
热议问题