bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hightlighting in bash


From: Greg Wooledge
Subject: Re: Hightlighting in bash
Date: Thu, 10 Mar 2011 14:53:29 -0500
User-agent: Mutt/1.4.2.3i

On Thu, Mar 10, 2011 at 11:42:25AM -0800, Philip Prindeville wrote:
> My request is simple.

HAH!  Lies....

> Using termcap/ncurses info (which you need anyway 
> for the readline stuff), it would be nice to have the option of running 
> commands in a pseudo-tty and then bracketing the output from STDERR with 
> <highlight on>...<highlight off>.

That's very much outside the scope of bash.  Bash just sets up FDs for
stdout and stderr (if requested -- otherwise, it doesn't even have to do
that much) and execs some other program.  It's the other program that
does the writing.  And it's the terminal that gets the data, in your
case.

It can't be done at the terminal level either, because the terminal doesn't
know whether the data it's getting went through the slot marked "1" or the
slot marked "2" on the sender's side.  It's just input.

So, you'd need some sort of independent program to sit between the app
you're running and the terminal.

Note that a lot of people attempt to do this using things like:

  red=... normal=...
  exec 2> >(while read -r; do echo "$red$REPLY$normal"; done)

Which may be good enough in some cases, but certainly isn't a robust answer.
(You can't get a robust solution using just a shell.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]