#!/bin/bash set -euf -o pipefail # Usage: # Check all scripts in the current working directory # ./sanity-check.sh # Check specific files # ./sanity-check.sh script1.sh script2.sh if [[ "$#" -eq 0 ]]; then files=() while IFS='' read -r line; do files+=("$line"); done < <(\ find . -name "*.sh" -o -name "*.job") else files=("${@}") fi # Assuming shellcheck >= 0.7.0 shellcheck "${files[@]}" --severity=warning