Skip to content

Files

Latest commit

 

History

History
29 lines (19 loc) · 801 Bytes

SC2288.md

File metadata and controls

29 lines (19 loc) · 801 Bytes

Pattern: Command name ends with a symbol

Issue: -

Description

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.

Example of incorrect code:

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

Example of correct code:

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

Further Reading