On Nov 23, 2007 11:01 PM, मनीष <[EMAIL PROTECTED]> wrote:
> On Nov 23, 2007 9:05 PM, Shamail Tayyab <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I've 2 queries..
> >     1. How can i make bash to display stdout and stderr in different
> > colors? If its possible..
>
> I will take a stab at this one. See below for a sample:
>
> $ exec 3>&1
> $ cat x 2>&1 >&3 | xargs echo -e "\033[40;31;1m"
> cat: x: No such file or directory               <-- this appears in red
> $ exec 3>&-
> $ cat >> x << !
> > test line 1
> > test line 2
> > !
> $ exec 3>&1
> $ cat x 2>&1 >&3 | xargs echo -e "\033[40;31;1m" <-- out is in normal color
> test line 1
> test line 2
>
> $ exec 3>&-
> $ rm x
> $ exec 3>&1
> $ cat x 2>&1 >&3 | xargs echo -e "\033[40;31;1m"
> cat: x: No such file or directory               <-- this appears in red again
> $ exec 3>&-
>
> HTH,
> --
> Manish
> References:
> 1. http://www.tuxmachines.org/node/11104
> 2. 
> http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/io-redirection.html

Did it work for you?

-- 
Manish
_______________________________________________
ilugd mailinglist -- [email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22/23, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/[email protected]/

Reply via email to