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

Re: coloring STDERR to terminal

Hash: SHA1

On Sun, 27 Jun 2004, ari wrote:

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:

 [ -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.

i guess this demonstrates what you mean by "asynchronous":
	{ echo -n a ; echo -n b >&2 ; echo c ; echo d >&2 ; }

(on freeBSD, "echo -n" suppresses the newline. i don't think that option is portable across all flavors of *nix)

the results are ~not~ what i would've though  ;)

it also doesn't do well at all with this command:
	gpg < clearsigned_file
which outputs some lines as STDERR, other lines as STDOUT.

and this isn't working anything the way i'd expect it to:
	time date > file_stdout 2> file_stderr

it seems that i can't redirect STDERR unless i run the command in curly-braces or parenthesis...
	{ time date ; } > file_stdout 2> file_stderr

back-quotes don't even work.


 PGP key - http://atom.smasher.org/pgp.txt
 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	"Cryptography is like literacy in the Dark Ages. Infinitely
	 potent, for good and ill... yet basically an intellectual
	 construct, an idea, which by its nature will resist efforts
	 to restrict it to bureaucrats and others who deem only
	 themselves worthy of such Privilege."
		-- Vin McLellan,
		A Thinking Man's Creed for Crypto
Version: GnuPG v1.3.6 (FreeBSD)
Comment: What is this gibberish?
Comment: http://atom.smasher.org/links/#digital_signatures


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