${(P)…}
: Parameter name indirection
${(P)name}
interprets the value of name
as further parameter name and then evaluates it.
Links
Examples
- Using parameter name indirection
- Output:
1 2 3 4 5 6
declare -A data=([key]=value [key2]=value2) name=data # Prints array 'data' echo ${(P)name} # Prints value of `key2` or array `data` echo ${${(P)name}[key2]}
1 2
value2 value value2
BashSupport Pro 是一款支持 P** 的 **Zsh 集成开发环境 - 立即试用!