You could use 'echo -e' to change your printout text and background color by some color variables. One of the easiest ways to use them is to define shell variable, for example, define those variables in your shell script:
red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color
. '\e[0;36m': 0's place is the color of background (0, no effect, 1, bold, 4, underline) and 36 is the text color. You also can change background colors due to color values in the color table. For example, '\e[41;34m' changes background color to red and text color to blue.
How to print?
echo -e "$red These texts are in red$NC" #you must use '-e' to enable interpretation of the backslash-escaped characters, see echo's help.
or if you want to use it in 'printf':
printf "%s\n" "`echo -e $red`These texts are in red`echo -e $NC`"
There is a table of color values attached (this table is from the link). You can find color values what you want.
Thursday, December 18, 2008
Linux:shell:Bash: How to change color of your shell printout
Subscribe to:
Post Comments (Atom)
2 comments:
Great!
Hi,
I have a signature field already in my document and I want to prompt the user to sign it. For instance, there are 100 pdfs with signature fields... I want to have a script run through VBA that opens all 100 PDDocs and prompts the user for 100 signatures so they dont have to go and open each one.
PDF signature
Post a Comment