Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: associative array questions
On 2022-12-12 20:39, Bart Schaefer wrote:
% : ${(P)list::="tea for two"}
%
Ha! I finally get to see that colon command do something. Anyway the
real situation is running into trouble (I try to keep my questions here
boiled down to the nub of the issue). What's being modified is an array
and the above method is interfering with the spit on lines; however it
seems to be the perfect example of eval doing the work as a visual
thinker would want it done:
local list=$1 # function takes name of array as argument.
eval 'list=( "${(@M)list:#(#i)*$SEARCHBUF*}" )' # filter the array.
... it has a sort of 'just-do-it' directness to it. The function was
previously working on only a specific array, and I'm trying to get it to
work on any array. Anyway the 'eval' method seems to work perfectly.
Subject to better advice of course.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author