Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: brace expansion not happening



Benjamin R. Haskell (zsh@xxxxxxxxxx) wrote on 8 January 2009 11:34:
 >On Thu, 8 Jan 2009, Frank Terbeck wrote:
 >
 >> Carlos Carvalho <carlos@xxxxxxxxxxxxxx>:
 >>
 >>> I need to do an expansion in more than one place, so I'd like to put
 >>> the pattern in a variable. However it's not equivalent:
 >> [...]
 >>> Putting in a variable:
 >>>
 >>> % list=a/{b,c}-d
 >>> %  for i in $list; do echo $i; done
 >>> a/{b,c}-d
 >>
 >> Use an array:
 >> % list=(a/{b,c}-d)
 >>
 >> The rest just work, just as you wrote it.
 >>
 >
 >This seems fine for the original question.

It is, worked perfectly for me. Thanks people.

 >But, how about the case of user input?
 >
 >e.g.
 >
 >$ read R
 >
 >## user enters: a/{b,c}-d
 >
 >Is there then no way to do brace expansion on R?

I think you must use foo=($R).



Messages sorted by: Reverse Date, Date, Thread, Author