color option for /bin/ls breaks shell scripts

James Mcphee jmcphe at gmail.com
Mon Jul 7 15:14:45 MST 2008


GNU ls also normally sheds it's colory ways if you send it into a pipe.

On Wed, Jul 2, 2008 at 1:53 PM, Charles Jones <
charles.jones at ciscolearning.org> wrote:

>  Charles Jones wrote:
>
> So he learned some valuable lessons:
> 1. Always call binaries by their full path (use /bin/ls) so you don't get
> bitten by an alias or something in $PATH overriding
> 2. bash -x -c 'command(s)' is helpful for debugging command-line shell
> 3. In some cases it's better to use something like: find . -name \*doc
> -exec command \;
>
> I also forgot:
>
> 4. You can safely alias ls to use color, if you use --color=auto.
>
> From the ls man page:
> With --color=auto, color codes are output only if standard output is
> connected to a terminal (tty).
>
> -Charles
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>



-- 
James McPhee
jmcphe at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080707/004452bc/attachment.htm 


More information about the PLUG-discuss mailing list