On Wed, Mar 17, 2021 at 09:11:48PM -0400, Dale R. Worley wrote: > I have it encoded in my head that $ inside "..." is respected. Subtly, > the $'...' construction is not respected inside "...".
Bash has 5 types of quoting: '...', "...", $'...', $"..." and backslash. $'...' is a form of quoting, not an expansion. It won't "work" inside of another type of quoting, just like '...' will not "work" inside "...". echo "foo is '$foo'" In this example, $foo is expanded, despite the fact that there are single quotes around it, because the single quotes have no meaning in this context. They're inside a *different* type of quoting, so they are just regular literal characters. The only exception here is backslash, which retains its special powers when inside "..." or $"...".