What does this do in bash: [@]?

Bo Berglund bo.berglund at gmail.com
Fri Jul 29 16:40:20 UTC 2022


On Fri, 29 Jul 2022 12:16:44 -0400, Little Girl <littlergirl at gmail.com> wrote:

>Hey there,
>
>Bo Berglund wrote:
>
>>What I do not know is what the [@] in "${URL[@]}" does???
>>
>>Where can I read bout this?
>
>The accepted answer on this page does a great job of demonstrating
>the difference between the way [@] and [*] treat the data:
>
>https://unix.stackexchange.com/questions/135010/what-is-the-difference-between-and-when-referencing-bash-array-values
>

So do I get it right?:

- Something gets stuffed into a bash variable like URL in the example
- When this variable is later used as the argument to curl then using [@] as
shown makes the arguments in $URL load separately into curl as a list of
different arguments

But if the content of $URL is a long stretch of arguments separated by spaces,
what is then the need for [@]???


-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list