#!/bin/bash # foreground color using ANSI escape fgBlack=$(tput setaf 0) # black fgRed=$(tput setaf 1) # red fgGreen=$(tput setaf 2) # green fgYellow=$(tput setaf 3) # yellow fgBlue=$(tput setaf 4) # blue fgMagenta=$(tput setaf 5) # magenta fgCyan=$(tput setaf 6) # cyan fgWhite=$(tput setaf 7) # white txReset=$(tput sgr0) # reset attributes imma_variable="bar" # Example 1: Output Foobar, with empty line before and after, in blue using echo. echo -e "\n${fgBlue}Foo${imma_variable}${txReset}" # Example 2: Output Foobar, with empty line before and after, in red using printf. printf '\n%s%s%s%s\n\n' ${fgRed} 'Foo' ${imma_variable} ${txReset} # need extra newline as printf doesn't give one by default # Some other settings I haven't tested - stole straight off Teh Intewebs # background color using ANSI escape bgBlack=$(tput setab 0) # black bgRed=$(tput setab 1) # red bgGreen=$(tput setab 2) # green bgYellow=$(tput setab 3) # yellow bgBlue=$(tput setab 4) # blue bgMagenta=$(tput setab 5) # magenta bgCyan=$(tput setab 6) # cyan bgWhite=$(tput setab 7) # white # text editing options txBold=$(tput bold) # bold txHalf=$(tput dim) # half-bright txUnderline=$(tput smul) # underline txEndUnder=$(tput rmul) # exit underline txReverse=$(tput rev) # reverse txStandout=$(tput smso) # standout txEndStand=$(tput rmso) # exit standout