[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: get back the expansion of ~ in associated array
From: |
alex xmb ratchev |
Subject: |
Re: get back the expansion of ~ in associated array |
Date: |
Mon, 17 Jul 2023 08:30:08 +0200 |
On Mon, Jul 17, 2023, 7:18 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> In old bash, ~ can be expanded in an associated array.
>
> $ bash --version | head -n 1
> GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin18.7.0)
> $ declare -A x=([a]=~)
> $ declare -p x
> declare -A x=([a]="/Users/py" )
>
~ $ home=~ ; declare -A x=( x "$home" ) ; declare -p x
declare -A x=([x]="/data/data/com.termux/files/home" )
~ $
In new bash, ~ can be not expanded in an associated array. How to get
> back the original behavior?
>
> $ bash --version | head -n 1
> GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin21.6.0)
> $ declare -A x=([a]=~)
> $ declare -p x
> declare -A x=([a]="~" )
>
> --
> Regards,
> Peng
>
>