bug-bash
[Top][All Lists]
Advanced

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

Re: Associative array keys are not reusable in (( command


From: Greg Wooledge
Subject: Re: Associative array keys are not reusable in (( command
Date: Mon, 11 Jan 2021 11:52:23 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

> > If you are reluctant to change semantics, how about a new parameter
> > transformation to quote values using `sh_single_quote'?
> 
> Why, when @Q already exists?

It's often the case that the strings generated by bash are being
fed to some other shell, where $'...' doesn't work.  Granted, you can
always do "'${myvar//$q/$q\\$q$q}'" (where q=\').

If the sh single quoting also helps you use associative array elements
inside a math context, then that would be a second reason.  But at this
point I can't even *guess* whether it's safe to use sh-single-quoted
associative array keys inside a math context.  I tried one with a
command substitution and a newline inside it, and it seemed to work, but
that doesn't mean it's *safe*.



reply via email to

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