
- Forum
- Operating Systems
- Shell Programming
- Colorful Scripts
Colorful Scripts
This is a discussion on Colorful Scripts within the Shell Programming forums, part of the Operating Systems category; I have written plenty of shell scripts and all is working fine. I like to add some more feature to ...
-
Colorful Scripts
I have written plenty of shell scripts and all is working fine. I like to add some more feature to this shell scripts. As a first step I want to add colors to my output of the shell scripts.Kindly suggest a way for adding this feature to make my scripts colorful.
-
12-24-2010, 01:21 PM #2
- Join Date
- Dec 2010
- Answers
- 32
Store the colors in a file and then source that file in batches as given:
[dot][space] /full_path_file_with_color_def_inside
. /full_path_file_with_color_def_inside
-
02-29-2012, 12:27 PM #3
- Join Date
- Feb 2012
- Answers
- 66
The following code can be used to add colors to the output
color effect [ lt fgcolor ] bgcolor
color list
where:
*fgcolor and bgcolor are one of black, red, green, yellow, blue, magenta, cyan or white.
*effect can be any of nm | normal , bd | bold , ft | faint , it | italic , ul | underline , bk | blink , fb | fastblink , rv | reverse , iv | invisible
*color off or just color resets to default colors and text effects.
*color list displays all possible color combinations.
Example
echo "$(color white blue) White text on a blue background $(color)"
echo "$(color bold red yellow blink) Blinking bold red text on a yellow background $(color)"
echo "$(color ltyellow green) lt prefix on the yellow text text $(color off)"
-
Sponsored Ads

Reply With Quote





