On Mon, Oct 05, 2015 at 02:13:14AM -0600, Mike Brown wrote:
> egrep is not aliased.

Clarification: I do have GREP_OPTIONS=--color=auto in my environment (FreeBSD 
uses GNU grep). If you were printing matching lines, i.e. not using -v, 
and not redirecting the grep output, the matching text would be colored red.
Obviously that's not applicable here.

Anyway, I have more info for you.

The output of these is the same:
'ls -ld /usr/.* | cat -vet'
'ls -ld /usr/.* | egrep -v '/\.\.?$' | cat -vet'

Here it is:
2 drwxr-xr-x  22 root  wheel      512B Aug 28  2013 
^[[1m^[[36m/usr/.^[[39;49m^[[m/$
2 drwxr-xr-x  21 root  wheel      1.0k Sep  3 17:29 
^[[1m^[[36m/usr/..^[[39;49m^[[m/$
2 drwxrwxr-x   2 root  operator   512B Aug 23 19:24 
^[[1m^[[36m/usr/.snap^[[39;49m^[[m/$

Now here's '/bin/ls -ld /usr/.* | egrep -v '/\.\.?$' | cat -vet':
drwxr-xr-x  22 root  wheel      512 Aug 28  2013 ^[[1m^[[36m/usr/.^[[39;49m^[[m$
drwxr-xr-x  21 root  wheel     1024 Sep  3 17:29 
^[[1m^[[36m/usr/..^[[39;49m^[[m$
drwxrwxr-x   2 root  operator   512 Aug 23 19:24 
^[[1m^[[36m/usr/.snap^[[39;49m^[[m$

Calling /bin/ls instead of my 'ls' alias, as you can see, results in some 
formatting changes due to the omission of -F: no trailing slashes on 
directories, 1st column is gone, BLOCKSIZE=1k environment variable ignored. 

The color is still there because I also have the environment variables 
CLICOLOR and CLICOLOR_FORCE set. The former is used by FreeBSD's /bin/ls to 
always output color, as if -G were set, and the latter is to ensure it happens 
even when piping the output (e.g. to 'less', as I do with another alias for 
long directory listings).

As long as you pipe the output, unsetting CLICOLOR_FORCE stops the coloring:

# unsetenv CLICOLOR_FORCE
# /bin/ls -ld /usr/.* | egrep -v '/\.\.?$' | cat -vet
drwxrwxr-x   2 root  operator   512 Aug 23 19:24 /usr/.snap$

#/bin/ls -ld /usr/.* | cat -vet
drwxr-xr-x  22 root  wheel      512 Aug 28  2013 /usr/.$
drwxr-xr-x  21 root  wheel     1024 Sep  3 17:29 /usr/..$
drwxrwxr-x   2 root  operator   512 Aug 23 19:24 /usr/.snap$

Some experimentation shows that the only way to be sure color is suppressed is 
to temporarily unset CLICOLOR_FORCE, if not also CLICOLOR. Unlike GNU ls's 
--color=[auto,none], there's no command-line option for BSD's /bin/ls that can 
override the effect of those environment variables. (And unsetting the 'color' 
shell variable only suppresses the tcsh's coloring of 'ls-F' called without 
arguments, n/a here.)

I hope this helps.

------------------------------------------------------------------------------
_______________________________________________
Rkhunter-users mailing list
Rkhunter-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkhunter-users

Reply via email to