Skip to content

Files

Latest commit

 

History

History
23 lines (14 loc) · 436 Bytes

SC2107.md

File metadata and controls

23 lines (14 loc) · 436 Bytes

Pattern: Use of && in [ .. ] test expression

Issue: -

Description

&& cannot be used in a [ .. ] test expression. Instead, make two [ .. ] expressions and put the && between them.

Example of incorrect code:

[ "$1" = "-v" && -z "$2" ]

Example of correct code:

[ "$1" = "-v" ] && [ -z "$2" ]

Further Reading