help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] colors break `env`, any solution?


From: Bob Proulx
Subject: Re: [Help-bash] colors break `env`, any solution?
Date: Sat, 21 Mar 2015 22:11:04 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Patrick Schleizer wrote:
> My goal is exporting the colors and still being able to run `env` with
> useable output.

The goal and the methods are in conflict.  You can have one or the
other but not both.  I suggest not exporting that into the
environment.  In scripts where you need it simply run tput there.

The env command prints the environment.  The value in red is in the
environment and is therefore printed out too.  When emitted to a
terminal the terminal will act upon it.  There can be no expectation
of anything different.

You could however pipe the output through another filter that would
supress escape sequences.  Here are some possibilities for you to
try.  In particular you should use a pager for viewing such things.
The pager less for example is well known and excellent and will
protect you from such output.

  env | less

  env | col -b

  env | sed -n l

Bob

P.S. Since 'cat' shouldn't have such creeping features I didn't
mention 'cat -v'.  http://harmful.cat-v.org/cat-v/



reply via email to

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