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

prepend to array?



Hi,

I've often found myself wanting to do this:

% zsh -c 'x=(a b c); x[0]+=(vip); echo $x'
zsh:1: x: assignment to invalid subscript range

I eventually realized I could write it this way instead:

% zsh -c 'x=(a b c); x[-999999]+=(vip); echo $x'
vip a b c

Is there any more elegant way to prepend?

Anthony



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