How does Bash deal with brackets inside of double quoting?

Viewed 1257

The question is basically, how does bash deal with double quotes and brackets?

I couldn't come up with a better example, so apologies about that, but imagine something like this:

"$(echo "${foo}")"

What happens there? Is ${foo} technically out of the quotation scope? Is bash smart enough to also consider that it is inside of the parentheses and work inside-out? Would \"${foo}\" work better?

I've tried Googling this, but no luck. Please note that this is different from just nested quoting questions, as it includes expansion.

Thanks!

3 Answers
Related