I'm using the following formatting for echo
It should output text that is both bold and underlined, but instead of making it bold it's giving a 'brighter' variant of color and takes the underlined code (4) as if it was cyan, resulting in Light Cyan text.
I'm using Cygwin's Bash on a windows 7 PC.
Edit: I've found a link that appears relevant to my case but I'm not sure how it applies since they're taking about the windows 10 update bash while I'm using Cygwin's enter link description here
It seems you are running bash through the old cygwin.bat, so you are using the Windows Console as terminal, and not through the default Mintty that is a more advanced Terminal.
By default Cygwin setup install the "Cygwin Terminal" entry in the windows menu
The content of the menu entry is like
C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
with path like
C:\cygwin64\bin
These items can be a also recreated at the last step of cygwin setup running.
There are two box entries :
□ Create icon on Desktop
□ Add icon to Start Menu
If you enable them, both will be recreated
I have this in my profile :
## NORMAL
export NORMAL=$(tput sgr0)
## FOREGROUND
export FGBLACK=$(tput setaf 0)
export FGRED=$(tput setaf 1)
export FGGREEN=$(tput setaf 2)
export FGYELLOW=$(tput setaf 3)
export FGBLUE=$(tput setaf 4)
export FGMAGENTA=$(tput setaf 5)
export FGCYAN=$(tput setaf 6)
export FGWHITE=$(tput setaf 7)
export FGBRIGHT=$(tput bold)
export FGNORMAL=$(tput sgr0)
export FGBOLD=$(tput bold)
## BACKGROUND
export BGBLACK=$(tput setab 0)
export BGRED=$(tput setab 1)
export BGGREEN=$(tput setab 2)
export BGYELLOW=$(tput setab 3)
export BGBLUE=$(tput setab 4)
export BGMAGENTA=$(tput setab 5)
export BGCYAN=$(tput setab 6)
export BGWHITE=$(tput setab 7)
## SHAPE
export SHUNDERLINE=$(tput smul)
export SHBOLD=$(tput bold)
export SHSBOLD=$(tput smso)
So I can easily use it in the command line or in my scripts. For instance :
#!/bin/bash
echo "This is ${FGRED}foreground red${NORMAL}"
echo "This is ${BGRED}background red${NORMAL}"
echo "This is ${FGYELLOW}${BGRED}background red and foreground yellow${NORMAL}"
echo "This is ${SHUNDERLINE}underlined${NORMAL}"
echo "This is ${FGCYAN}${SHUNDERLINE}cyan underlined${NORMAL}"
echo "This is ${SHBOLD}bold${NORMAL}"
echo "This is ${SHUNDERLINE}${SHBOLD}underlined bold${NORMAL}"
echo "This is ${FGBLUE}${SHBOLD}blue bold${NORMAL} and this ${FGBLUE} normal blue${NORMAL}"
echo "This is ${SHSBOLD}standout bold${NORMAL}"
Which results in outputs like this :
Hope its useful for you!