[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Behaviour of test -v with assoc array and quote character in key
From: |
Greg Wooledge |
Subject: |
Re: Behaviour of test -v with assoc array and quote character in key |
Date: |
Tue, 23 Feb 2021 07:55:02 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Feb 23, 2021 at 12:17:10PM +0100, Alex fxmbsw7 Ratchev wrote:
> what, sorry, mailing stuff isnt much clear to me, ... its not possible to
> have a var=\'\] ; assoc[$var] ?
It should work for simple assignment and retrieval.
You need to add quotes for [[ -v 'assoc[$var]' ]] to work, and math
contexts are dodgy as hell. No amount of quoting will make
(( 'assoc[$var]'++ )) work. If you want to increment the value of
this array element, you'll need to retrieve it into a temporary string
variable, increment that, and then copy it back into the array.
- Behaviour of test -v with assoc array and quote character in key, Daniel Gröber, 2021/02/14
- Re: Behaviour of test -v with assoc array and quote character in key, Greg Wooledge, 2021/02/15
- Re: Behaviour of test -v with assoc array and quote character in key, Chet Ramey, 2021/02/15
- Re: Behaviour of test -v with assoc array and quote character in key, Andreas Schwab, 2021/02/23
- Re: Behaviour of test -v with assoc array and quote character in key, Greg Wooledge, 2021/02/23
- Re: Behaviour of test -v with assoc array and quote character in key, Oğuz, 2021/02/23
- Re: Behaviour of test -v with assoc array and quote character in key, Greg Wooledge, 2021/02/23
- Re: Behaviour of test -v with assoc array and quote character in key, Oğuz, 2021/02/23
- Re: Behaviour of test -v with assoc array and quote character in key, Chet Ramey, 2021/02/23