Re: bash, grep, and regular expressions
On Sat, 19 Feb 2005 07:45:57 -0800, Freddy Freeloader
<fredddy@cableone.net> wrote:
> I set it up as alias ls="ls -al --color=always". On one of the IT sites
> I spend a fair amount of time on a *nix admin with quite a few years
> experience said he has run into problems using aliases on some machines
> too, so I guess it isn't unknown. I thought it was pretty strange that
> it screwed things up too, but it certainly did make a difference.
Perhaps the problem is that this produces lines like:
-rw-r--r-- 1 marsh marsh 6811 Sep 27 22:50 ESC[0m.XdefaultsESC[0m
That is, it's including ASCII color codes.
This was produced with:
ls -al color=always | cat
>From ls(1):
By default, color is not used to distinguish types of files. That is
equivalent to using --color=none. Using the --color option without the
optional WHEN argument is equivalent to using --color=always. With
--color=auto, color codes are output only if standard output is con-
nected to a terminal (tty).
If you change your alias to "ls -al --color=auto", you should be
golden, since ls will recognize that it's writing to a pipe, not the
terminal.
--
Michael A. Marsh
http://www.umiacs.umd.edu/~mmarsh
Reply to:
- References:
- bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>
- Re: bash, grep, and regular expressions
- From: Pigeon <jah.pigeon@ukonline.co.uk>
- Re: bash, grep, and regular expressions
- From: Mike <mikewk147@comcast.net>
- Re: bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>
- Re: bash, grep, and regular expressions
- From: Michael Marsh <michael.a.marsh@gmail.com>
- Re: bash, grep, and regular expressions
- From: Freddy Freeloader <fredddy@cableone.net>