is fedora really bleeding edge?

Greg Woods woods at ucar.edu
Mon Mar 5 23:16:45 UTC 2012


On Mon, 2012-03-05 at 23:26 +0100, Marko Vojinovic wrote:

> Umm, now I'm confused. While I do understand what you are trying to say, I see 
> that the outputs of "yum list selinux*" and "yum list selinux\*" are exactly 
> the same:

That is because, in THIS case, "selinux*" doesn't match any files in the
current directory. Create an empty file called "selinux1" and repeat the
two commands and you will see what I mean.

Bash is the first shell I have ever used that will pass on an unmatched
wildcard as a literal. Try the same thing with an older shell such as
csh, for instance:

$ csh
$ yum list selinux*
yum: No match.
$ yum list selinux\*

(Produces a verbose list of matching packages)

In bash, both of these produce the package list as you saw.

Whether this is good or bad is a religious war. A good part of the time,
the bash way saves you from having to explicitly escape wildcards that
you know will not match. 

Both shells will give likely unexpected results for the unescaped form
if the wildcard should happen to match something. 

Which is better is a religious war. A good part of the time, the bash
way saves you from having to explicitly escape wildcards that you know
will not match. Since I have been using bash for a few years now, I have
become lazy and started depending on this bash behavior. But the csh way
forces you to always escape wildcards that you mean to pass on as
literals, so the unexpected behavior when the wildcard matches something
is less likely to occur. Every once in a while I do get a wildcard that
matches unexpectedly and I go, what the hell? Until I realize what
happened.

--Greg




More information about the users mailing list