cc: [email protected]
Subject: Re: [ast-users] Enumerate member variable names in compound variable?
--------
> Developers, has any one found a way to enumerate the names of members
> in a compound variable, e.g. if I have compound var=( a=2 b=5
> c='hello' ) I like to have the list "a b c". How can I do that?
>
> Olga
You could write a function like the following:
>
===============cut here======================
function members
{
typeset nval
nameref var=$1
[[ ! -v var ]] && return 1
for nval in $(print -v var | grep =)
do print ${nval%%=*}
done
}
compound var=( a=2 b=5 c='hello' )
members var
===============cut here======================
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users