Day wrote:
Yes, Bob. This problem came out because I set an alias for `ls' in
my .bashrc file
alias ls='ls -F --color'
So when I run the script what goes in to the [] test is `ls -F
--color -A ./dir' in fact. Thus issued the problem. Thanks for your
msg.
Hmm... But aliases are not used
Bob Proulx [EMAIL PROTECTED] wrote:
How did you happen to run into using 'ls --color' in a test such as
this? That seems an unfortunate option choice there. I recommend not
using --color there. But obviously you already thought of that and so
I have to ask what you were doing that caused
Eric Blake wrote:
It may be worth considering a patch to coreutils, such that plain --color
implies --color=auto rather than --color=always. For example, this would
match how 'git config' reacts when interpreting color options (where
'auto' and 'true' are synonyms, and 'always' must be
Eric Blake [EMAIL PROTECTED] wrote:
According to Jim Meyering on 2/12/2008 11:30 AM:
|
| Here's the result I'll push in a day or two:
What about the corresponding patch to dircolors?
I haven't done that yet.
Would you like to do it?
FYI, this time, I'm adding a dist check to ensure the sets
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
According to Jim Meyering on 2/12/2008 11:30 AM:
|
| Here's the result I'll push in a day or two:
|
| ls --color no longer outputs unnecessary escape sequences
| In --color mode, plain files do not get any color, not even white.
|
Jim Meyering [EMAIL PROTECTED] wrote:
Here's the result I'll push in a day or two:
ls --color no longer outputs unnecessary escape sequences
BTW, that patch reduces by up to about 60% the size of the output
of ls -C --color=always when there are many short-named files,
e.g., as you'd see
Eric Blake [EMAIL PROTECTED] wrote:
According to Day on 2/11/2008 8:35 PM:
|
| [ $(ls -A --color ./dir) ] echo Not Empty || echo Empty
|
| the echoed message is always Not Empty, regardless of the fact that
./dir is actually EMPTY. Below is the tested result.
Thanks for the report.
Day wrote:
I found this bug when I tried a tiny script which checks a directory
is empty or not.
[ $(ls -A ./dir) ] echo Not Empty || echo Empty
So far so good.
After `mkdir ./dir' and without adding anything into ./dir, run the
script, the echoed message is Empty. But when adding the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
According to Day on 2/11/2008 8:35 PM:
|
| [ $(ls -A --color ./dir) ] echo Not Empty || echo Empty
|
| the echoed message is always Not Empty, regardless of the fact that
./dir is actually EMPTY. Below is the tested result.
Thanks for the report.
I found this bug when I tried a tiny script which checks a directory is empty
or not.
[ $(ls -A ./dir) ] echo Not Empty || echo Empty
After `mkdir ./dir' and without adding anything into ./dir, run the script, the
echoed message is Empty. But when adding the `--color' option to `ls',
[
10 matches
Mail list logo