Re: color option for /bin/ls breaks shell scripts

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: James Mcphee
Date:  
To: Main PLUG discussion list
Subject: Re: color option for /bin/ls breaks shell scripts
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 <
> 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 -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>




--
James McPhee

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss