Missing Spaces in Comparison Medium

The comparison operators in double square brackets and single square bracket tests need to be surrounded by spaces to be recognized as operators. Without the spaces, the shell will interpret the expression differently, potentially leading to unexpected results. To avoid this issue, always use spaces around comparison operators in shell tests.

Detector ID
shell/missing-spaces-in-comparison@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-
Tags
-