LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   I want my script output in bold and color fonts (https://www.linuxquestions.org/questions/linux-general-1/i-want-my-script-output-in-bold-and-color-fonts-711526/)

gdan2000 03-14-2009 03:37 AM

I want my script output in bold and color fonts
 
Hi,

Is there way to "echo" script output in bold or color fonts ?

H_TeXMeX_H 03-14-2009 05:36 AM

See here:
http://tldp.org/LDP/abs/html/colorizing.html

You could do something like:

Code:

end='\E[m'
bold='\E[1m'
red_fg='\E[31m'
green_bg='\E[42m'

# bold
echo -e "[${bold}${red}Downloading${end}]"

# bold red foreground
echo -e "[${bold}${red_fg}Downloading${end}]"

# bold red foreground green background
echo -e "[${bold}${red_fg}${green_bg}Downloading${end}]"

Or try the script in the link I posted.

gdan2000 03-15-2009 05:31 AM

thanks a lot
 
this is exactly what I was looking for

is there trick to print blinking line, e.g. to print error message?

H_TeXMeX_H 03-15-2009 06:34 AM

Well, actually, it is possible ... see this utility script:
http://scriptechocolor.sourceforge.net/

Normally you could do:

Code:

bash-3.1$ blink='\E[5m'
bash-3.1$ end="\\033[m"
bash-3.1$ red_fg="\\033[31m"
bash-3.1$ echo -e "[${blink}${red_fg}Downloading${end}]"

With the utility you can just type:

Code:

echoc "@{nr}test"
Note: this works only in terminals that support it ... like xterm.

gdan2000 03-15-2009 08:48 AM

Thanks a lot again

H_TeXMeX_H 03-15-2009 09:09 AM

No problem, I was kinda looking for a text color utility too, this one seems to be good.

davender84 03-16-2009 06:29 AM

Quote:

Originally Posted by gdan2000 (Post 3475093)
Hi,

Is there way to "echo" script output in bold or color fonts ?

you can use tput command in ur script to to this


All times are GMT -5. The time now is 05:25 AM.