http://qs321.pair.com?node_id=640950


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

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

Replies are listed 'Best First'.
Re^4: Working with Binary Numbers
by salva (Canon) on Sep 25, 2007 at 14:50 UTC
    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."

        it seems to me you just disproved yourself.

        yes, that was my intention :-)

        I was not trying to maintain my position but just to follow the "The documentation I could find isn't great on this point" on blokhead response.

        That's also why I used bash docs instead of csh, because they looked more clear to me and with regard to brace expansion, both shells behave the same.