Rob Landley wrote:
I just fired up an Aboriginal system image with bash 2.05b (the much less bloated version), and under that the third case _also_ prints "/bin/{a,b}*", so the behavior of this corner case changed between bash versions. Most likely somebody reported the third case as a bug and they fixed the one defect report without fixing the general case, because they're the FSF and everything is a special case to them.The bash manual is quite explicit in the ordering of the expansion: brace expansion, variable expansion, pathname expansion (globbing). Also, brace expansion is different from globbing in that it is just a string manipulation without references to the file system.The _important_ test is just: v='/bin/*'; echo $vWhich answers the simple question of glob precedence: does it happen before or after the variable substitution? And if the answer is "after" (which it is), then that's what we should do. Perform globbing after substituting variables. {a,b} is part of globbing the same way * and ? and [x-y] and such are.
The result of {a,b} is always a b.
The result of [ab] depends on the content of the current directory.
The fact that bash is a buggy pile of crap that can't even consistently implement its own extensions is not our problem. We should do the simple thing and wait for the FSF to catch up. (Specifically, wait for somebody replying on this _obvious_bug_ to complain, and then tell them to complain to the bash guys and make sure they don't _fix_ their inconsistency first.)
Ralf _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
