Instead of those hard-coded escape sequences, use:
tput smul # set underline
tput rmul # remove underline
tput smso # set bold on
tput rmso # remove bold
tput setaf 1 #red
tput setaf 2 #green
...
tput cup 0 0 # move to pos 0,0
Refer to "man terminfo" and "man tput" for complete descriptions of these commands.
Examples :
function f_help
{
c_green=$(tput setaf 2 2>/dev/null)
c_reset=$(tput sgr0 2>/dev/null)
c_bold=$(tput smso 2>/dev/null)
echo "${c_bold}DESCRIPTION${c_reset} : ...."
}
echo "${c_green}GREEN ${c_underline} GREEN AND UNDERLINED${c_nounderline} GREEN AGAIN${c_reset} PLAIN BLACK TEXT"
The ${c_underline} escape sequence doesn't affect the color of the text; it only turns underlining on. ${c_nounderline} only turns underlining off.