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

Re: selecting a subset of an array



Kagawa-san,
try using ${array-namae:#pattern} Here's the explanation I found in the manual.

--> If the parameter  is an ARRAY the matching array elements are removed.
For the opposite effect use the `(M)' flag to remove the non-matched elements).

Darel Henman

--------------------

Wataru Kagawa wrote:

Sorry for another basic question, but how do I exclude a particular element from an array by using its name in a parameter expansion? For example, I would like to select everything except for 'foo1:output file' from the following array, using only 'foo1' in the expansion.

_list=( 'foo1:output file' 'foo2:input file' 'foo3:output figs' 'foo4:input figs' )

Help is much appreciated.

Wataru Kagawa




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