lint.sh: better shebang lint (#33296)

-e
old-commit-hash: 585f362738908bb4c98e87fac0cd7cb64a78d6b4
This commit is contained in:
Maxime Desroches
2024-08-14 11:34:52 -07:00
committed by GitHub
parent 35a99d7fc6
commit dc396b6301
3 changed files with 12 additions and 10 deletions
+2 -2
View File
@@ -2,12 +2,12 @@
FAIL=0
if grep '^#!.*python$' $@ | grep -v '#!/usr/bin/env python3$'; then
if grep '^#!.*python' $@ | grep -v '#!/usr/bin/env python3$'; then
echo -e "Invalid shebang! Must use '#!/usr/bin/env python3'\n"
FAIL=1
fi
if grep '^#!.*bash$' $@ | grep -v '#!/usr/bin/env bash$'; then
if grep '^#!.*bash' $@ | grep -v '#!/usr/bin/env bash$'; then
echo -e "Invalid shebang! Must use '#!/usr/bin/env bash'"
FAIL=1
fi