Bash variable expansion and brace expansion

Viewed 77

I wonder why I get different results with this:

echo {a,b}.txt
a.txt b.txt

and this other:

A="a,b"                                                          
echo {$A}.txt                                                    
{a,b}.txt

I expect both of them to behave the same.

1 Answers

You can try

A="a,b"
eval echo {$A}.txt

you get,

a.txt b.txt
Related