From f9b6aec1b461de371954c81ec5e4562012146e19 Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 28 Feb 2015 18:43:15 -0800 Subject: [PATCH] Created SC2153 (markdown) --- SC2153.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SC2153.md diff --git a/SC2153.md b/SC2153.md new file mode 100644 index 0000000..fd28a3b --- /dev/null +++ b/SC2153.md @@ -0,0 +1,21 @@ +## Possible Misspelling: MYVARIABLE may not be assigned, but MY_VARIABLE is. + +### 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, which has a name remarkably similar to one that is explicitly assigned. 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 something assigned 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}`. \ No newline at end of file