aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorvim88 <vim88vim88@gmail.com>2018-11-28 22:43:18 +0200
committervim88 <vim88vim88@gmail.com>2018-12-02 16:14:21 +0200
commit688f665a5e526fda0fb797bf617412fe9cbe64fd (patch)
tree5a9dc35e71cfd69c01a5c6a9aa18282483b2538b /test
parent60b20c869f8df9a81b5080ebcbe8c9cf4e6b9d77 (diff)
downloadbitcoin-688f665a5e526fda0fb797bf617412fe9cbe64fd.tar.xz
Scripts and tools & Docs: Used #!/usr/bin/env bash instead of obsolete #!/bin/bash, added linting for .sh files shebang and updated the Developer Notes.
Diffstat (limited to 'test')
-rwxr-xr-xtest/lint/lint-python-dead-code.sh2
-rwxr-xr-xtest/lint/lint-shebang.sh (renamed from test/lint/lint-python-shebang.sh)9
2 files changed, 9 insertions, 2 deletions
diff --git a/test/lint/lint-python-dead-code.sh b/test/lint/lint-python-dead-code.sh
index 3341f794f9..4561b0db30 100755
--- a/test/lint/lint-python-dead-code.sh
+++ b/test/lint/lint-python-dead-code.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
diff --git a/test/lint/lint-python-shebang.sh b/test/lint/lint-shebang.sh
index 4ff87f0bf7..fda22592d3 100755
--- a/test/lint/lint-python-shebang.sh
+++ b/test/lint/lint-shebang.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Shebang must use python3 (not python or python2)
+# Assert expected shebang lines
export LC_ALL=C
EXIT_CODE=0
@@ -10,4 +10,11 @@ for PYTHON_FILE in $(git ls-files -- "*.py"); do
EXIT_CODE=1
fi
done
+for SHELL_FILE in $(git ls-files -- "*.sh"); do
+ if [[ $(head -n 1 "${SHELL_FILE}") != "#!/usr/bin/env bash" &&
+ $(head -n 1 "${SHELL_FILE}") != "#!/bin/sh" ]]; then
+ echo "Missing expected shebang \"#!/usr/bin/env bash\" or \"#!/bin/sh\" in ${SHELL_FILE}"
+ EXIT_CODE=1
+ fi
+done
exit ${EXIT_CODE}