2015-04-17 19:12:30 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-08-31 13:54:25 +00:00
|
|
|
checkshellscript() {
|
|
|
|
filelist="$1"
|
|
|
|
checkfun="$2"
|
|
|
|
|
2018-09-03 00:50:27 +00:00
|
|
|
printf '%s\n' "$filelist" | while IFS= read -r file
|
2018-08-31 13:54:25 +00:00
|
|
|
do
|
|
|
|
$checkfun "$file"
|
2018-09-03 00:50:27 +00:00
|
|
|
done
|
2018-08-31 13:54:25 +00:00
|
|
|
}
|
|
|
|
|
2018-09-03 00:50:27 +00:00
|
|
|
if [ -f "$1" ]; then
|
|
|
|
SCRIPTS="$1"
|
|
|
|
else
|
|
|
|
SCRIPTS=$(git grep '^#!/bin/sh' | cut -d: -f1)
|
|
|
|
fi
|
2018-08-31 13:54:25 +00:00
|
|
|
|
2018-09-03 00:50:27 +00:00
|
|
|
checkshellscript "$SCRIPTS" "shellcheck --format=gcc"
|
|
|
|
checkshellscript "$SCRIPTS" checkbashisms
|