Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Colorized output when piping to tee
Date: Mon, 18 Dec 2017 20:12:41
Message-Id: 20171218201154.tvkftox4gi5rg62v@grusum.endjinn.de
In Reply to: [gentoo-user] Colorized output when piping to tee by Ramon Fischer
1 Hello,
2
3 On Mon, 18 Dec 2017, Ramon Fischer wrote:
4 >I am looking for a way to have a colorized output when piping to tee, e.g.:
5 >
6 > /usr/bin/emerge --ask --update --deep --newuse --tree --verbose @world | tee --append nom.txt
7 >
8 >I already tried installing "dev-tcltk/expect" which should actually contain "unbuffer" which can help me out. But there is no unbuffer command.
9
10 # qfile `which unbuffer`
11 app-misc/unbuffer (/usr/bin/unbuffer)
12
13 >Am I missing something or is there any other way to do that?
14
15 unbuffer won't help you there anyway. That only changes when stuff is
16 written to the pipe.
17
18 You're actually looking for:
19
20 ====
21 --color < y | n >
22 Enable or disable color output. This option will override
23 NOCOLOR (see make.conf(5)) and may also be used to force color
24 output when stdout is not a tty (by default, color is disabled
25 unless stdout is a tty).
26 =====
27
28 BTW: if you don't want that colorized output in the log, add
29
30 app-text/ansifilter (/usr/bin/ansifilter)
31
32 for reading the log.
33
34 HTH,
35 -dnh
36
37 --
38 MCSE: "Microsoft Certified Stupidity enclosed" -- A. Spengler