Remove Leading Spaces Before Shebang Medium

Leading spaces before the shebang (#!) can prevent the script from executing properly. To ensure correct script execution, the shebang must be placed at the very beginning of the file without any preceding whitespace.

Detector ID
shell/remove-leading-spaces-before-shebang@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-
Tags
-

Noncompliant example

1	 
2# Noncompliant: Leading spaces before the shebang.
3  #!/bin/bash
4echo "Hello Shell"

Compliant example

1	 
2# Compliant: Shebang starts at the very first character of the line.
3#!/bin/bash
4echo "Hello Shell"