Skip to content

Commit 84c790f

Browse files
authored
Merge pull request #4 from bdossantos/style/bash
style: bash
2 parents 398fd61 + 1d7dae3 commit 84c790f

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

pre_commit_hooks/shell-lint.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
echo "begin shellcheck"
3+
set -o errexit
4+
set -o pipefail
5+
set -o nounset
46

5-
which shellcheck &> /dev/null
6-
if [[ $? != 0 ]]; then
7-
echo "are you sure you have installed shellcheck?"
8-
exit 1
9-
fi
7+
DEBUG=${DEBUG:=0}
8+
[[ $DEBUG -eq 1 ]] && set -o xtrace
9+
10+
echo 'Begin shellcheck'
1011

11-
shellcheck $@
12-
exit $?
12+
if ! which shellcheck &>/dev/null; then
13+
>&2 echo 'shellcheck command not found'
14+
exit 1
15+
fi
1316

17+
shellcheck "$@"

0 commit comments

Comments
 (0)