bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {varname} for redirection does not work with arrays


From: Stephane CHAZELAS
Subject: Re: {varname} for redirection does not work with arrays
Date: Sat, 5 Nov 2011 19:34:54 +0000 (UTC)
User-agent: slrn/pre1.0.0-18 (Linux)

2011-11-2, 12:01(-06), unknown@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]