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

Re: easy calling of associative array?



On 11/02/2015 02:10 PM, Bart Schaefer wrote:
   echo_v () {
     [[ -n $1 ]] && (( ${(P)+1} )) &&
     print -R "${(P)${:-${1}[${(b)2}]}}"
   }

   get_v () {
     [[ -n $1 && $3 != *=* ]] && (( ${(P)+1} )) &&
     typeset -g "${3:-REPLY}=${(P)${:-${1}[${(b)2}]}}"
   }

As Peter once observed, there are no obfuscated code contests in zsh ;-)



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