-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindentationcheck.sh
executable file
·23 lines (21 loc) · 1.08 KB
/
indentationcheck.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
MYDIR="$(cd -P "$(dirname "${0}")" && pwd)"
echo '#####################################################################################'
echo ' Bash code must be indented with TABs. Checking for lines indented with spaces ... '
echo '#####################################################################################'
grep -n '^[[:space:]]* [[:space:]]*' "${MYDIR}"/../{bin,lib}/*.*sh
grep_exit_status="${?}"
if [[ "${grep_exit_status}" -eq 0 ]]; then
echo '#####################################################################################'
echo ' ERROR: found Bash files containing lines (partially) indented with spaces.'
echo '#####################################################################################'
exit 1
elif [[ "${grep_exit_status}" -eq 1 ]]; then
echo ' Ok: all Bash files indented with TABs.'
echo '####################################################################################'
exit 0
else
echo ' FAILED: indentation sanity check failed.'
echo '####################################################################################'
exit 1
fi