LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-14-2009, 03:37 AM   #1
gdan2000
LQ Newbie
 
Registered: Mar 2009
Posts: 8

Rep: Reputation: 0
I want my script output in bold and color fonts


Hi,

Is there way to "echo" script output in bold or color fonts ?
 
Old 03-14-2009, 05:36 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.
 
Old 03-15-2009, 05:31 AM   #3
gdan2000
LQ Newbie
 
Registered: Mar 2009
Posts: 8

Original Poster
Rep: Reputation: 0
thanks a lot

this is exactly what I was looking for

is there trick to print blinking line, e.g. to print error message?
 
Old 03-15-2009, 06:34 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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.

Last edited by H_TeXMeX_H; 03-15-2009 at 07:19 AM.
 
Old 03-15-2009, 08:48 AM   #5
gdan2000
LQ Newbie
 
Registered: Mar 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks a lot again
 
Old 03-15-2009, 09:09 AM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
No problem, I was kinda looking for a text color utility too, this one seems to be good.
 
Old 03-16-2009, 06:29 AM   #7
davender84
Member
 
Registered: Feb 2009
Posts: 42

Rep: Reputation: 15
Smile

Quote:
Originally Posted by gdan2000 View Post
Hi,

Is there way to "echo" script output in bold or color fonts ?
you can use tput command in ur script to to this
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to turn off bold fonts in xterm? sidd-ua Linux - Software 2 08-19-2008 04:46 PM
fonts are bold shahin123 Linux - Newbie 6 05-13-2008 04:49 AM
Uneven bold fonts in Firefox Wynd Slackware 8 02-08-2007 04:52 AM
No bold fonts on firefox 1.5.0.1 mushk45 Linux - Software 2 03-13-2006 11:09 AM
Fonts in X big and bold when not using gdm LSA Linux - General 0 03-16-2004 05:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration