This is a theoretical question to understand what is going behind the scenes.
If I run this:
q=( 11 22 33 )
q="${q-()}"
declare -p q
it outputs the expected:
declare -a p=([0]="11" [1]="22" [2]="33")
But if I run:
q=( 11 22 33 )
q="${q[@]-()}"
declare -p q
then I get this:
declare -a p=([0]="11 22 33" [1]="22" [2]="33")
I understand which way is the correct one, but I cannot explain why the latter produces the result it does. Can someone explain this?