The option
ALL_EXPORT (-a) is described as automatically exporting all parameters
subsequently defined. This extends to parameters subsequently assigned, including ones with a subscript:
% zsh -c 'typeset VAR=123; set -a; VAR[2]=X; set +a; typeset -p VAR; printenv VAR'
export VAR=1X3
1X3
% zsh -c 'typeset VAR=123; VAR[2]=X typeset -p VAR; VAR[2]=X printenv VAR'
typeset VAR=1X3
This discrepancy looks strange to me. I expected that "VAR[n]=val cmd" would export VAR. I find the lack of export even stranger given that "VAR[n]=val" exports VAR when ALL_EXPORT is enabled.
Wdyt? Could we change inline assignments to also export parameters with a subscript?
Philippe