From: Jim Hranicky Date: 2009-02-17T01:49:24+09:00 Subject: [ruby-core:22186] Re: Dir.glob and duplicates? Thomas Enebo wrote: > ls {/Users,/Users,/Users}/enebo > > It is a good question why many impls all decided to copy this behavior, > but it is there and I am guessing the reason for supporting it is > "principle of least surprise" (and yes I find this somewhat ironic). > > -Tom > > PS- For the record globbing with {} is one of my favorite shortcuts ls > -l foo{,~}, but I have never used the dup feature. So this is news to > me until this thread :) Interesting -- being a zsh user I've always thought of braces differently than other shell globbing because braces simply evaluate to what you specify regardless of whether there are any files that match: % echo {a,b,c} a b c % echo a* b* c* zsh: no matches found: a* This allows for cool things like % mv /some/horribly/long/pathname/Id/hate/to/have/to/type/twice{,.bak} bash works a little differently though with wildcards, which I assume to be more like the original Bourne shell: [jfh@kestrel e]$ echo {a,b,c} a b c [jfh@kestrel e]$ echo a* b* c* a* b* c* tcsh seems to work like zsh. I think if ruby globbing is to mimic shell globbing, dups would have to be allowed when and only when braces are specified. ---------------------------------------------------------------------- | Jim Hranicky, Security Engineer UF InfoSec Team | | E202 SSRB Phone (352) 392-2061 | | jfh@ufl.edu | ----------------------------------------------------------------------