help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Filename Expansion: Find Utility vs Bash Shell Pattern M


From: Chet Ramey
Subject: Re: [Help-bash] Filename Expansion: Find Utility vs Bash Shell Pattern Matching
Date: Thu, 18 Jun 2015 15:31:01 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 6/18/15 11:24 AM, Michael Convey wrote:

> *​...​Every​ ​implementation of globbing is slightly different.  There are
> no standards.You seem to be asking "which library function does ___ use" as
> if thatwould reveal the answer to the your real question "to which
> globbingstandard does ____ conform", but there are no such standards in
> thefirst place.​ ​Right now, you just have to learn each program's features
> one by one.​*

I disagree with this.  It's a little bit more cynical than necessary, I
think.

> I was attempting to determine which globbing library is used by each
> program to better make sense of why different programs implemented globbing
> differently.  For example, if find and bash both used fnmatch, then I could
> try to understand how the defaults were set be each program. However, I've
> learned that bash does not use fnmatch, but strmatch -- which is based on
> an old version of fnmatch. It would be nice if all programs who implement
> globbing migrated to a common library. The way it is now, it is
> inconsistent and confusing for the learner. If Linux and related programs
> (bash, find, etc.) "standardized" more on common libraries, mastering these
> areas would be less time consuming.

Standardization is the solution here, but perhaps not in the way you
expect.  The benefit of standards is that they allow you to rely on the
set of standardized features and expect that those features will work
identically across all implementations that claim conformance.  It also
allows you to identify extensions or optional behavior and, depending on
your needs, use or not use those features as appropriate.

Using common libraries is ultimately less effective because it limits each
progam to the library feature set.  As long as you rely on the
standardized set of capabilities, bugs aside, it should not matter which
program you're using or the library code those programs use.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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