What does this do in bash: [@]?

Little Girl littlergirl at gmail.com
Sun Jul 31 17:21:23 UTC 2022


Hey there,

Colin Watson wrote:
 
>> This is out of my element, though. I'm more of a Python person, but
>> this is interesting, so I figured I'd jump in. Now I have to go
>> find out if I can make this happen in Python.

>This sort of thing is generally much easier in Python, since its
>quoting and variable handling rules aren't completely ridiculous and
>arcane (and I say that as somebody who did a lot of shell
>programming for many years).  You'd have to go out of your way in
>Python *not* to handle lists of strings in this completely
>reasonable way - the whole [@] business is really just telling bash
>to expand an array variable and not to do the weird historical shell
>thing of smashing everything together into a single word.

Yeah, I've dabbled around in Bash for various purposes, but never got
to know it. I just look up what I need when I need it and collect
anything I find useful.

>The associative array example there in Python is just the obvious way
>that dicts work there, with 90% less bizarre punctuation.

True, although I couldn't help but find this syntax from the Stack
Overflow page to be attractive for some reason:

	continent[Vietnam]=Asia
	continent[France]=Europe
	continent[Argentina]=America

-- 
Little Girl

There is no spoon.




More information about the ubuntu-users mailing list