How does one output bold text in Bash?

后端 未结 5 1853
南笙
南笙 2020-12-02 03:55

I\'m writing a Bash script that prints some text to the screen:

echo \"Some Text\"

Can I format the text? I would like to make it bold.

5条回答
  •  囚心锁ツ
    2020-12-02 04:27

    I assume bash is running on a vt100-compatible terminal in which the user did not explicitly turn off the support for formatting.

    First, turn on support for special characters in echo, using -e option. Later, use ansi escape sequence ESC[1m, like:

    echo -e "\033[1mSome Text"
    

    More on ansi escape sequences for example here: ascii-table.com/ansi-escape-sequences-vt-100.php

提交回复
热议问题