On Nov 5, 12:34 pm, Stephane CHAZELAS <stephane_chaze...@yahoo.fr> wrote: > 2011-11-2, 12:01(-06), unkn...@vmw-les.eng.vmware.com: > [...]> Description: > > If {varname} is an assoc. array in a redirection the exec will fail > > The [] should not be confused with pathname expansion just like ${}. > > > Repeat-By: > > $ declare -A array > > $ exec {array[key]}<file > > [...] > > In the documentation, it's {VARNAME}<file, so bash works as > documented. > > zsh doesn't support {array[key]}<file either. > > ksh does though it's not documented (documented the same as > bash). > > The work around is easy though: > > $ declare -A array > $ exec {var}<file > $ array[key]=$var > > -- > Stephane
Hello Stephane, The workaround is trivial, its just inconsistent (with other parts of bash). I can say: $ declare -A array $ read -r 'array[key]' <<< 'foo' This also makes arrays more directly useful. $ declare -A fd $ local fifo $ exec {fifo}<"${fifo_path}" $ fd[fifo]="${fifo}" $ unset fifo becomes $ declare -A fd $ exec {fd[fifo]}<"${fifo_path}"