Sensitive whitespace of bourne shells High

Bourne shells are highly sensitive to whitespace, meaning that adding or removing spaces can drastically alter the meaning of a script. ShellCheck has detected that a space is missing at the indicated position, which could lead to unexpected behavior. Correcting these whitespace issues is crucial for ensuring the script functions as intended.

Detector ID
shell/sensitive-whitespace-of-bourne-shells@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-
Tags
-

Noncompliant example

1
2# Noncompliant: Missing space after `[[` in conditional expression.
3while [["$COUNT" -lt 10 ]]; do
4  echo "$COUNT"
5  ((COUNT++))
6done

Compliant example

1
2# Compliant: Correct spacing allows proper parsing of the conditional expression.
3while [[ "$COUNT" -lt 10 ]]; do
4  echo "$COUNT"
5  ((COUNT++))
6done