Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 680 Bytes

SC1140.md

File metadata and controls

25 lines (15 loc) · 680 Bytes

Pattern: Unexpected parameter after condition

Issue: -

Description

ShellCheck found characters (other than redirections) after the ] or ]] in a test expression. This is not valid.

This sometimes happens when there was an additional expression or command, but joining || or && is missing. Alternatively, it could happen due to typos (like [[ $1 ]]] with an extra ]), or generally from malformed test expressions.

Example of incorrect code:

[ "$1" ] input="$1"

Example of correct code:

[ "$1" ] && input="$1"

Further Reading