mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 13:37:02 +01:00
e8ae07c2e8
The `# run-shellchek` tag must be placed in the first 10 lines of the file
23 lines
514 B
Bash
Executable File
23 lines
514 B
Bash
Executable File
#!/bin/bash
|
|
# run-shellcheck
|
|
# please do not run this script directly but `docker_build_and_run_shellcheck.sh`
|
|
|
|
files=""
|
|
retval=0
|
|
|
|
if [ $# -eq 0 ]; then
|
|
files=$(find . -name "*.sh")
|
|
else
|
|
files="$*"
|
|
fi
|
|
|
|
for f in $files; do
|
|
if head "$f" | grep -qE "^# run-shellcheck$"; then
|
|
printf "\e[1;36mRunning shellcheck on: %s \e[0m\n" "$f"
|
|
if ! /usr/bin/shellcheck --color=always --external-sources --shell=bash "$f"; then
|
|
retval=$((retval + 1))
|
|
fi
|
|
fi
|
|
done
|
|
exit "$retval"
|