The more general solution (not specific to a Linux console) is to use "tput"
For example (straight from "man tput"):
bold=`tput smso`;offbold=`tput rmso`
You can then use the variables to turn on and off attributes.
echo "This is $bold bold $offbold but this is not"
Note that you don't need "-e" because this puts out the actual binary values.
It's also a bit easier than remembering escape sequences, and has the advantage of portability: if the If you want to store something for use somewhere else, you can give the terminal type:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.