Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: coloring STDERR to terminal



atom@xxxxxxxxxxxxxx mentioned:

> i'm not sure if this is possible without patching some sources, but here's 
> what i want to do... every time STDERR is directed to a terminal, i want 
> to filter it through _something_like_ this:
> 	awk '{print "^[[91m"$0"^[[0m"}'

Perhaps not what you're looking for, since the effect is asynchronous,
but you _could_ do this with a variation of:

  ERRFIFO=$HOME/.stderr-$TTY.fifo
  [ -p $ERRFIFO ] || mkfifo $ERRFIFO
  awk '{print "^[[91m"$0"^[[0m"}' <$ERRFIFO 1>&2 &

  exec 2>$ERRFIFO

Execution of this segment would, of course, need to be restricted to
once per terminal session.

ari



Messages sorted by: Reverse Date, Date, Thread, Author