Exforsys
+ Reply to Thread
Results 1 to 3 of 3

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 ...

  1. #1
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128

    Thumbs up 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.


  2. #2
    Manyamanas is offline Member Array
    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


  3. #3
    Sandhya.Kishannag is offline Member Array
    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



Latest Article

Network Security Risk Assessment and Measurement

Read More...