.bashrc .profile .bash_profile

Derek Harland derek at chocolate-fish.com
Tue Oct 6 21:41:42 PDT 2009


Hi Scott

If stdout is not a terminal then "ls" disables color information by  
default.  So if you want to pipe it to anything like grep then you  
*must* have CLICOLOR_FORCE in the environment.

But as Brandon points out, that can bite you in general ... perhaps  
you want to define an alias with a different name to ls that does want  
you want.

For example, here's what my bashrc defines

	function ll () { command env CLICOLOR_FORCE=X ls -lAFG "$@" | less - 
R; }

Perhaps you want something like

	function myls () { command env CLICOLOR_FORCE=X ls -la "$@" | grep - 
v .DS_Store; }

derek

On 7/10/2009, at 5:17 PM, Scott Haneda wrote:

> On Oct 6, 2009, at 6:22 PM, Brandon Allbery wrote:
>
>>> So, can I use it and not export it?  It seems in all examples I  
>>> can find, CLICOLOR_FORCE needs to be exported, but maybe there is  
>>> a "set" way to do it, 'SET CLICOLOR_FORCE' in which case it would  
>>> not be exported, but just available to me for my session?
>>
>> Is there some reason you insist on CLICOLOR_FORCE instead of  
>> CLICOLOR?  This *will* hurt you.
>>
>> There's a way to set it without exporting it, yes --- but if it's  
>> not exported, ls won't see it.
>
>
> Just could never get it to work...
> # Color output
> export CLICOLOR=1
> #export CLICOLOR_FORCE=1
> export LSCOLORS=dxfxcxdxbxegedabagacad
>
> If I type ls -la I get coloring, if I use an alias based on the same  
> thing, I get no coloring.  Ah ha, I was aliasing ls -la | grep - 
> v .DS_Store, which kills the color.
>
> Suggestions on how to mask out those files, and still maintain my  
> colors?
> -- 
> Scott * If you contact me off list replace talklists@ with scott@ *
>
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users



More information about the macports-users mailing list