aboutsummaryrefslogtreecommitdiff
path: root/lint/bin.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-31 22:05:59 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-31 22:07:30 +1300
commit4cf6ed691373bd3cd0c84369e48f735db8d8fd30 (patch)
treefc4f84b7a88aec3c31caebdfd43ba3f9269a7afd /lint/bin.sh
parentShow explicit success message for `lint-bin` (diff)
downloaddotfiles-4cf6ed691373bd3cd0c84369e48f735db8d8fd30.tar.gz
dotfiles-4cf6ed691373bd3cd0c84369e48f735db8d8fd30.zip
Add conditional Bash `check-bin`, `lint-bin`
Both blocks are analogues of the POSIX checks, but are wrapped in a conditional so that bash(1) doesn't become a hard dependency of the default `make install` target.
Diffstat (limited to 'lint/bin.sh')
-rw-r--r--lint/bin.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/lint/bin.sh b/lint/bin.sh
index db74c3dd..5c33aa7d 100644
--- a/lint/bin.sh
+++ b/lint/bin.sh
@@ -1,6 +1,19 @@
+# POSIX sh
set --
for sh in bin/*.sh ; do
set "$@" "${sh%.sh}"
done
shellcheck -e SC1090 -- "$@" || exit
printf 'sh(1) binscripts linted successfully.\n'
+
+# GNU Bash
+if command -v bash >/dev/null 2>&1 ; then
+ set --
+ for bin in bin/*.bash ; do
+ set "$@" "${sh%.sh}"
+ done
+ shellcheck -e SC1090 -- "$@" || exit
+ printf 'bash(1) binscripts linted successfully.\n'
+else
+ printf 'bash(1) not found, skipping lint.\n'
+fi