FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

SC2192 · koalaman/shellcheck Wiki · GitHub

SC2192 · koalaman/shellcheck Wiki · GitHub
Skip to content

Navigation Menu

Joachim Ansorg edited this page Nov 12, 2021 · 3 revisions

This array element has no value. Remove spaces after = or use "" for empty string.

Problematic code:

array=([1]=one [2]= two)

Correct code:

array=([1]=one [2]=two)

Rationale:

You have an array element on the form [index]=. The shell will interpret this as an independent element with index index and value <empty string>.

This may happen as part of the expression [index]= value, where the space is not allowed and causes the shell to interpret it as [index]="" [index+1]=value.

If you wanted the element to have a value, remove the spaces after =, e.g. [index]=value.

If you wanted to assign an empty string, explicitly use empty quotes: [index]="". This makes no difference to the shell, but will make your intention clear to shellcheck and other humans.

Exceptions:

None.

Wiki pages Pages 545

Clone this wiki locally

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL