SC2288 – ShellCheck Wiki

See this page on GitHub

Sitemap


This is interpreted as a command name ending with apostrophe. Double check syntax.

(also applies to multiple other characters like .,([{<>}])#"')

Problematic code:

var=$("wget 'http://www.shellcheck.net/'")
echo Usage: $0 {start|stop|restart}
array=val1, val2, val3

Correct code:

var="$(wget 'http://www.shellcheck.net/')"
echo "Usage: $0 {start|stop|restart}"
array=(val1 val2 val3)

Rationale:

ShellCheck found a command name ending with a symbol, such as a comma, parenthesis, quote, or similar. This is almost always due to a syntax issue in the script.

In the examples, bad quoting and invalid array syntax caused the shell to try to run commands ending in apostrophe, curly brace, and comma, respectively.

Exceptions:

If you have a command that does end in a symbol, you can ignore this message.


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