Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Working with Binary Numbers

by salva (Canon)
on Sep 25, 2007 at 13:55 UTC ( [id://640937]=note: print w/replies, xml ) Need Help??


in reply to Re: Working with Binary Numbers
in thread Working with Binary Numbers

It seems to me that you are abusing a bug in glob

After expanding the pattern it should check that the entries actually exist on the file system and return only those that do.

Replies are listed 'Best First'.
Re^3: Working with Binary Numbers
by blokhead (Monsignor) on Sep 25, 2007 at 14:30 UTC
    This rule does not apply to {x,y,z} alternations in the glob pattern. The documentation I could find isn't great on this point, and its language is generally in terms of filenames. But I'm 99% sure it's not a bug. I've seen tons of uses of glob in this way on PM!

    BTW, the same behavior should happen in your shell (though it may be a different glob under the hood).

    $ ls {x,y,z} ls: x: No such file or directory ls: y: No such file or directory ls: z: No such file or directory
    First, glob expands {...} and then it checks the filesystem to expand * and ? and the resulting pattern(s).
    $ ls *{p,q,r} ls: *p: No such file or directory ls: *q: No such file or directory ls: *r: No such file or directory

    blokhead

      That's what bash docs says about the matter:

        Just to be clearer, if you read the first two sentences of the long section you quoted, it answers your original concern:

        Brace expansion is a mechanism by which arbitrary strings may be generated. This mechanism is similar to pathname expansion, but the filenames generated need not exist.

        So, no, this is not a bug.

        - tye        

        If bash had any bearing in the matter — glob is based on csh's expansion mechanism — it seems to me you just disproved yourself. "the filenames generated need not exist."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://640937]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found