Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inverted text on tty 1

Status
Not open for further replies.

scienzia

Programmer
Feb 21, 2002
160
IT
Hi,

I have a simple question:

is it possible to write in a tty some text inverted as if it was highlighted?

Thanks in advance
 
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:

bold=`tput -Tlinux smso`

etc.






Tony Lawrence
Linux/Unix/Mac OS X Resources
 
I prefer the first because I use it in a program, and it is easier to insert some digits in output than executing a program.

Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top