help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Specifying multiple index numbers in array


From: Greg Wooledge
Subject: Re: [Help-bash] Specifying multiple index numbers in array
Date: Fri, 3 May 2013 14:26:10 -0400
User-agent: Mutt/1.4.2.3i

On Fri, May 03, 2013 at 01:54:42PM -0400, Jerry wrote:
> declare -a FOO=(zero one two three four five six)
> 
> now, if I wanted to extract index 2 and index 4, how could I do it?

You could get index 2 *through* index 4 using a range notation, but not
2 and 4 skipping 3.

printf '<%s> ' "address@hidden:2:3}"; echo

If you want 2 and 4 skipping 3, then using two separate expansions is
the only way.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]