You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simon Brandt edited this page Mar 4, 2025
·
6 revisions
Possible Misspelling: MYVARIABLE may not be assigned. Did you mean MY_VARIABLE?
Problematic code:
MY_VARIABLE="hello world"echo"$MYVARIABLE"
Correct code:
MY_VARIABLE="hello world"echo"$MY_VARIABLE"
Rationale:
ShellCheck has noticed that you reference a variable that is not assigned in the script, but which has a name similar to another known variable. You should verify that the variable name is spelled correctly.
Note: This error only triggers for environment variables (all uppercase variables), and only when they have names similar to another known variable in the script. If the variable is script-local, it should by convention have a lowercase name, and will in that case be caught by SC2154 whether or not it resembles another name.
Exceptions:
If you've double checked and ensured that you did not intend to reference the specified variable, you can disable this message with a directive. The message will also not appear for guarded references like ${ENVVAR:-default} or ${ENVVAR:?Unset error message here}.