Skip to content
Vidar Holen edited this page Oct 11, 2018 · 1 revision

Expected this to be an argument to the unary condition.

Problematic code:

[ -x ]

Correct code:

[ -x "myfile" ]

Rationale:

ShellCheck has found a unary test operator that does not appear to be followed by a valid shell word.

This could be because of a misplaced ], ), or a missing space before the ].

Check the syntax, make sure the test operator has an operand, and try again.

Exceptions:

None.

Related resources:

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally