[Toybox] bash continues to confuse me.

Rob Landley rob at landley.net
Fri Jun 19 04:53:32 PDT 2020

On 6/18/20 6:48 PM, Rob Landley wrote:
> On 6/18/20 1:46 PM, Chet Ramey wrote:
>> On 6/17/20 1:22 PM, Rob Landley wrote:
>>> Trying to figure out when spaces are and aren't allowed in ${blah} led to asking
>>> why echo ${!a* } is an error but ${!a@ } isn't (when there are no variables
>>> starting with a), and I eventually worked out that:
>>>   $ X=PWD
>>>   $ echo ${!X at Q}
>>>   '/home/landley/toybox/clean'
>>> Is going on? 
>> It's variable transformation. It's introduced by `@' and uses single-letter
>> operators. I cribbed the idea from mksh and extended it. The syntax is kind
>> of loose because I'm still experimenting with it.
> I know what the @Q part does:
>   $ chicken() { echo "${@@Q}"; }; chicken one two three
>   'one' 'two' 'three'

Well, I SORT of know what it does:

  $ a='*'; xx() { echo "${!a at Q}";}; xx one two three
  'one' 'two' 'three'

Shouldn't that be 'one two three'? (Why do a=@ and a='*' produce the same output


More information about the Toybox mailing list