Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Expand array into multiple elements per item?
On Tue, 13 Sep 2011, Anthony Charles wrote:
Hi,
You can try this :
print -l -- "-id "$^somelist
anotherlist=( "-id "$^somelist )
But I can't give you any answer for question 2 :/
anotherlist should end up as I specified before:
$ anotherlist=( -id 'a b' -id c -id 'd e' )
I.e. separate elements, but not just word-splitting everything:
$ print -l - $^anotherlist
-id <-- separate
a b <-- kept as one argument
-id <-- separate
c
-id <-- separate
d e <-- kept as one argument
With your suggestions the -id isn't a separate element:
$ print -l - "-id "$^somelist
-id a b
-id c
-id d e
$ anotherlist=( "-id "$^somelist )
$ print -l - $^anotherlist
-id a b
-id c
-id d e
--
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author