LinuxQuestions.org
Visit Jeremy's Blog.
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 09-04-2008, 04:17 PM   #1
wiredguy
LQ Newbie
 
Registered: Sep 2008
Posts: 2

Rep: Reputation: 0
anyone know of a way to customize the coloriing of a bash screen?


I'm looking to have the screen do the following:

Anytime any program outputs a line containing the word 'error' or 'warning' I want that whole line to turn red or blue. I use a suite of third party tools that print out a stream of info messages (one per line) and the errors and warning info messages tend to get lost, since there is a really large amount of data being pushed to the screen.

Being able to add more colorings based on a regex matching would be awesome.
 
Old 09-04-2008, 05:07 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
There's log watchers that can do that. I forgot the name but I'm sure loganalysis.org, Freshmeat, Sourceforge, Savannah or Berlios could show some.
 
Old 09-04-2008, 05:10 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
here's a little script I found online that's nicer than the one I created for myself.

Code:
#!/bin/bash
#
#   This file echoes a bunch of color codes to the 
#   terminal to demonstrate what's available.  Each 
#   line is the color code of one forground color,
#   out of 17 (default + 16 escapes), followed by a 
#   test use of that color on all nine background 
#   colors (default + 8 escapes).
#

T='gYw'   # The test text

echo -e "\n                 40m     41m     42m     43m\
     44m     45m     46m     47m";

for FGs in '    m' '   1m' '  30m' '1;30m' '  31m' '1;31m' '  32m' \
           '1;32m' '  33m' '1;33m' '  34m' '1;34m' '  35m' '1;35m' \
           '  36m' '1;36m' '  37m' '1;37m';
  do FG=${FGs// /}
  echo -en " $FGs \033[$FG  $T  "
  for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en "$EINS \033[$FG\033[$BG  $T  \033[0m";
  done
  echo;
done
echo
Just remember to use "echo -e" when you finally find the color code(s) you want. I'm guessing this is what you're after:

echo -e "\e[1;37m\e[41mhello\e[m"

Last edited by BrianK; 09-04-2008 at 05:17 PM.
 
Old 09-04-2008, 06:56 PM   #4
wiredguy
LQ Newbie
 
Registered: Sep 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
There's log watchers that can do that. I forgot the name but I'm sure loganalysis.org, Freshmeat, Sourceforge, Savannah or Berlios could show some.
I was hoping someone could point me to one or two script, or suggest search words. I keep getting scripts that do not allow the coloring of arbitrary program output. (Or they suck at handling sig terms)
 
  


Reply

Tags
bash, color, customize



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 can I customize the Gnome splash screen? quep_fly Linux - Software 1 02-10-2008 09:10 PM
customize ssh login screen chess Slackware 4 01-31-2006 01:55 PM
customize bash kpachopoulos Linux - General 2 05-27-2005 02:50 PM
customize login screen jscerb Linux - Software 3 10-31-2003 05:59 AM
Customize BASH Prompt kleptos Linux - Newbie 15 01-02-2003 12:01 PM

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

All times are GMT -5. The time now is 01:46 AM.

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