Terminals.. in the Unix sense... have capabilities. Even pseudo-terminal graphical clients.
The "right" answer is to properly query the terminal capabilities and use the data passed back as the "right" way to present terminal attributes.
For example.... doing bold=`tput bold` (or you use $()'s for ksh or bash) will get you the capabilities string for enabling BOLD on the terminal.
sgr=`tput sgr0` will give you the string for doing a capabilities reset.
So.. then, you can:
echo "The following is ${bold}BOLD${sgr}... see it?"
To get underline, smul=`tput smul`
Now... color is HARDER. Unless you limit your terminal choices. You can look at your terminal capabilities in total using "infocmp".. HOWEVER, that assumes you have a terminal definition that adequately covers your whole set of terminal capabilities (and... having done this for a LONG time... most DO NOT cover the whole set).
On ANSI like terminals, you can usually do tput setaf <number> to set a foreground color and tput setab <number> to set a background color... Setting the palette of colors is again a VERY terminal - to - terminal specific thing... sometimes it can be altered, sometimes not. Some terminals allow selection of colors using a longer syntax wherein color values can be given. Again, color is a "less" portable option.
The termcap and (now) terminfo way of handling terminal capabilities is a VERY good and generic way of dealing with multi-vendor devices. As with most all things Unix, the "standard" is to support them all!!!!
As I wrote in Chapter 14 of my book, Pro Bash Programming:
"Traditionally, screen manipulation is done through the termcap or terminfo database that supplies the information necessary to manipulate any of dozens or even hundreds of types of terminal. The shell interface to the database is an external command, tput.
On some systems, tput uses the termcap database; on others (mostly newer systems) it uses the terminfo database. The commands for the two databases are not the same, so a tput command written for one system may not work on another.
On one system, the command to place the cursor at the 20th column on the 10th row is:
tput cup 9 19
On another system, the command is:
tput cm 19 9
These commands will produce the correct output for whatever type of terminal is specified in the TERM variable. (Note: tput starts counting at 0.)
However, the plethora of terminal types has, for all intents and purposes, been reduced to a single, standard type. This standard, ISO 6429 (also known as ECMA-48, and formerly known as ANSI X3.64 or VT100), is ubiquitous, and terminals that do not support it are few and far between. As a result, it is now feasible to code for a single terminal type. One advantage of this homogeneity is that the necessary coding can be done entirely within the shell. There's no need for an external command."
I wrote a script which run in my AIX box, store a copy of output in to the same box and then send this copy to my mail address into windows outlook.... it is working as exected and sending me mail.....
I just want to add some blinking text....
eg:
if [condition}
ehco " This is good"
else
echo "Attention: this is not good "
fi
Please suggest is there any way to blink this else part of the script.
so that when it send me a mail (into outlook) it shows in blinking.....