From 53bf3492e819c658426df553e01da61a1175ef44 Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Thu, 26 Jan 2023 21:04:34 +0100 Subject: [PATCH] maint: add shebang This commit adds a test called `shebang`, which checks if all shebangs in scripts use relative paths through `#/usr/bin/env`, rather than absolute paths, such as `#/bin/bash`. See 833b10575bbb18200ae9e6ba4f0a1dd858417020. --- maint/shebang | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 maint/shebang diff --git a/maint/shebang b/maint/shebang new file mode 100755 index 000000000..5d9483bf3 --- /dev/null +++ b/maint/shebang @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if git grep -rnI "^#\!/" :/ | grep -v "#\!/usr/bin/env" +then + echo "Absolute shebangs found, replace them with \"#!/usr/bin/env\"" + exit 1 +else + echo "Everything seems ok" + exit 0 +fi