Skip to content

Add linting for portable shebang usage in shell scripts

Problem Statement

We don't have linting to catch non-portable shebangs in shell scripts. In !207179 (merged), scripts using #!/bin/bash failed on NixOS because /bin/bash doesn't exist on that system.

Impact

Scripts break on systems where hardcoded paths like /bin/bash don't exist. We only catch these during code review or when users report failures, which wastes time on preventable issues.

Proposal

Add linting to flag hardcoded shebang paths and suggest portable alternatives like #!/usr/bin/env bash. This could be a shellcheck rule, CI check, or pre-commit hook.

References

Edited by Nao Hashizume