Skip to content
Joachim Ansorg edited this page Nov 15, 2021 · 2 revisions

Double quotes must be outside ${}: ${"invalid"} vs "${valid}".

Problematic code:

echo ${"USER"}

Correct code:

echo "${USER}"

Rationale:

ShellCheck found a parameter expansion containing what appears to be a quoted variable name.

While the parameter expansion itself must be quoted, as in "${valid}", the quotes may not appear inside the {} as in ${"invalid"}.

Also note that translated strings like $"Hello" may not use curly braces.

Exceptions:

None

Related resources:

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature guerraart8 to find a specific , or see Checks.

Clone this wiki locally