We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 398fd61 + 1d7dae3 commit 84c790fCopy full SHA for 84c790f
1 file changed
pre_commit_hooks/shell-lint.sh
@@ -1,13 +1,17 @@
1
-#!/bin/bash
+#!/usr/bin/env bash
2
3
-echo "begin shellcheck"
+set -o errexit
4
+set -o pipefail
5
+set -o nounset
6
-which shellcheck &> /dev/null
-if [[ $? != 0 ]]; then
7
- echo "are you sure you have installed shellcheck?"
8
- exit 1
9
-fi
+DEBUG=${DEBUG:=0}
+[[ $DEBUG -eq 1 ]] && set -o xtrace
+
10
+echo 'Begin shellcheck'
11
-shellcheck $@
12
-exit $?
+if ! which shellcheck &>/dev/null; then
13
+ >&2 echo 'shellcheck command not found'
14
+ exit 1
15
+fi
16
17
+shellcheck "$@"
0 commit comments