Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
brace expansion in array subscript
- X-seq: zsh-users 18991
- From: Rory Mulvaney <rorymulv@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: brace expansion in array subscript
- Date: Sun, 27 Jul 2014 14:57:36 -0500 (CDT)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:user-agent:mime-version :content-type; bh=0KqLrPAwGF6voxeRtfBEY/jwCxMbwbLpelljm9Stcmg=; b=SjLlnZd6GFycRRFbrj4cqIlzSlLqVDnlFf+GprV18gjcCVs0JdgVrlRstFn4qYcS7E lKIP6jFcx3OXuOhFHmlyAuQChKhAUGdc3zuhdLrs17xJAaU4jS9QqRhcVv9ZHGjtWY1v yrXhStxmDwiqE9jXhGnqnqOEW3WjhrD3QhaKpt5bzizrdq4T43ljkB4Meu+Ndn6OOlqK 6b+P6+MeV+WuHkN+6RhxfpJImx1eoOdC19TQpqG+6/XzteLJiOwyIVJII/Fn7agqtbav jEzdH6meJRCUwU6fYr8AxNEYfo9CdILRPrVKwNiyFNDQxQEKqOdfVF/maJxEo8VUluut +kTQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hi,
I'm wondering if it's possible to somehow specify a set of indices to an
array using brace expansion, to get a subset of the indices? To get
indices 2 and 5 of the array "arr", I'd like to use something like:
arr=( elt1 elt2 elt3 elt4 elt5 elt6 )
echo ${arr[{2,5}]}
Why doesn't that get expanded into "echo ${arr[2]} ${arr[5]}"?
It seems there would be lots of convenient uses of this feature.
Thanks in advance,
Rory
Messages sorted by:
Reverse Date,
Date,
Thread,
Author