From c2d145387694a3fb16a08ea6750fc3a83587cea1 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Mon, 7 Apr 2025 19:07:23 +0200
Subject: [PATCH] lint: sh: improve shellscript detection

- Implify filename check
- Check for ! in shebang
- Check for either /bin/sh or anything ending with the word bash
---
 scripts/lint-sh.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lint-sh.sh b/scripts/lint-sh.sh
index 013ef1c5c..e6cf28498 100755
--- a/scripts/lint-sh.sh
+++ b/scripts/lint-sh.sh
@@ -3,7 +3,7 @@
 set -e
 
 is_scriptfile() {
-	echo "$1" | grep -qE '.*\.sh$' || head -n1 "$1" | grep -qE '^#.*(sh|bash)$'
+	echo "$1" | grep -q '\.sh$' || head -n1 "$1" | grep -qE '^#!(.*\<bash|/bin/sh)$'
 }
 
 find contrib -type f | while read -r file; do
-- 
GitLab