[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read builtin oddity/bug in bash 3.2?
From: |
Daniel Musgrave |
Subject: |
Re: read builtin oddity/bug in bash 3.2? |
Date: |
Thu, 26 Oct 2006 23:34:08 +0000 |
Chet Ramey wrote:
> Daniel Musgrave wrote:
>> I have found a seeming inconsistency with the behavior of the read
>> builtin of bash (3.2.0(1)-release, also tested in 3.00.15(1)-release).
>> I'm working on a Centos 4.4 system (RedHat derivative). Let me describe
>> the conditions that cause the bug in as much detail as I have discovered
>> thus far.
>
> There are a couple of things that might shed light on your situation.
> First, [w] is a globbing pattern that matches `w'. Second, /usr/bin/w
> exists as an executable file.
>
> So, in /usr/bin, [w] will be globbed to `w', since there is a matching
> filename.
>
> Chet
>
Of course, I had completely forgotten about globbing. I suppose the first
thing I should have done would be to look in /usr/bin for a file called `w',
but up until today I was unaware there were any binaries with single-character
names (it would have been more obvious if I were getting `cp' back, or
something). After reading the filename expansion section of the manual, it
seems that setting the nullglob shell option would make the other patterns that
I was inadvertently specifying expand into a null string if they didn't match
any files in the directory, rather than just to the pattern themselves.
Thanks for clearing that up.
Daniel