bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release


From: Robert Elz
Subject: Re: Difference of extglob between 5.0.0(1)-release and 4.4.23(1)-release
Date: Sun, 13 Jan 2019 08:22:20 +0700

    Date:        Sat, 12 Jan 2019 17:58:12 -0600
    From:        Peng Yu <address@hidden>
    Message-ID:  <address@hidden>

  | I don't think it is a good idea to introduce such kind of special
  | cases. If @() should match an empty string, the least surprising
  | definition is that it should match empty string everywhere.

Yes, and it does I think.   That isn't the issue.   The issue is that
(for historical reasons) a '.' that starts a filename has special
matching rules, and can only be matched by an explicit '.' in
the pattern and only whet that '.' is either the first character in the
pattern, or immediately after a '/' - in no other cases does a filename
starting with a '.' (where by filename here, I mean the entry in
any directory) ever match a glob pattern.

In yoru exmaple...

The pattern
        ./$null"$dir"/

is expanded (parameter expansion) to

        ./@()./

which does not have a "." immediately after the / and
tus cannot match any filename (incoludeing ".") which
starts with a '.' character.

The leading '.' in that pattern "./" is fine and will match the
current directory "." (well, there are no patterns, so no
matching, it just is the cirrent directory).

  | Weight the surprise that it could introduce, does the benefit 
  | of introducing special cases large enough to allow those
  | special cases?

The surprise would be if this ever did work, as the way leading
filename '.' chartacters work as been in unix glob handling for
more than 40 years.   It means that when you say "*" you don't
get "." or any other files that start with "." included (etc).  And
the rule has always beenvery simple.   You want '.' you write '.'
(even writing it as [.] which, given '.' is not special in glob
patterns woudl mean the exact same thing for any other
character, is not defined to work for this, and can result in
nothing possibly matching (this is an unspecified case.)

You need to learn the rules.

kre

ps; there is a very good chance that this message will not get
to Peng Yu ... gmail and munnari dislike each other (well, gmail
dislikes munnari, munnari is pretty tolerant and keep trying anyway...)
that is unless he is on the list and gets the message that way.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]