shebang_has_executable
Every file starting with #! must have +x set. Catches scripts that got their +x bit stripped by git add --chmod=-x, a tar round-trip, or a cp across filesystems.
Options
Section titled “Options”This rule takes no kind-specific options.
Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”Scripts with a shebang but no executable bit
Section titled “Scripts with a shebang but no executable bit”The rule fires on this repository:
README.mdscripts/scripts/build.pyscripts/hello.shscripts/plain.md# demo#!/usr/bin/env python3print('x')#!/bin/shecho hino shebangWith this .alint.yml:
version: 1rules: - id: shebang-needs-x kind: shebang_has_executable paths: "scripts/**" level: erroralint check reports:
--- scripts/build.py ----------------------------------------------------------- x error shebang-needs-x shebang script is not marked executable
--- scripts/hello.sh ----------------------------------------------------------- x error shebang-needs-x shebang script is not marked executable
Summary (2 violations): x 2 errors 0 passing * 1 failingA shebang script that carries the executable bit
Section titled “A shebang script that carries the executable bit”This repository is compliant:
README.mdscripts/scripts/hello.sh (executable)# demo#!/bin/shecho hiWith this .alint.yml:
version: 1rules: - id: shebang-needs-x kind: shebang_has_executable paths: "scripts/**" level: erroralint check reports:
v All 1 rule(s) passed.