SC2285 – ShellCheck Wiki

See this page on GitHub


Remove spaces around += to assign (or quote '+=' if literal).

Problematic code:

var += "my text"

Correct code:

var+="my text"


ShellCheck found an unquoted += after a word. To append text to a variable, remove spaces around += as in the example.


If the += was supposed to be literal, you can quote it to make ShellCheck ignore it:

grep '+=' files..

ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.