From: bsa@kf8nh.wariat.org (Brandon S. Allbery) Subject: Re: [Q] How to colorize directory listings? Date: Tue, 4 May 1993 21:46:57 GMT
In article <gilC6IIrq.70s@netcom.com> gil@netcom.com (Gilbert Nardo) writes:
> A note of caution when using this ls: some scripts rely on
>getting names via ls, but with the color option the command returns
>filenames with prepended escape codes (set color codes). This becomes
>a problem when the scripts are doing things like generating makefiles
>which require exact target name matching. If you are set on using
>the ls with color, then you may have to tack on the --no-color option
>for these cases (I don't know if there's an environment variable you
>can set to have this toggle on and off).
If you've got it turned on unconditionally, you deserve what you get.
I generally use this bit of code on systems that support ksh.
# from my .env (ENV=$HOME/.env export ENV):
case "$-" in
*i*) # aliases and functions only valid in an interactive shell here
;;
esac
(Actually, I do a ". $HOME/.alias" in my .env for interactive shells; the
syntax is cleaner.)
With bash it's even easier: anything in your $HOME/.bashrc will be read only
by interactive shells *unless you set $ENV to also be $HOME/.bashrc*. Which
means there's very little excuse for interactive functions and/or aliases
being executed from shell scripts.
++Brandon
-- Brandon S. Allbery kf8nh@kf8nh.ampr.org bsa@kf8nh.wariat.orgIt's not too late to turn back from the "Gates" of Hell... Linux: the free 32-bit operating system, available NOW. Why waaaaaait for NT?