mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-24 23:21:12 -05:00
95aabd4cfa
Introduce a new configuration variable, BASH_EXEC_IGNORE_LIBRARIES. If set to true, the behaviour of bash-exec is modified: if a shell file has a file extension and no shebang line, it is ignored, i.e., allowed to be non-executable. This allows files that are only every sourced from other shell files, acting as libraries and not executables, to have no executable bit set without failing the bash-exec linter.
16 lines
342 B
Bash
Executable file
16 lines
342 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
FILE="${1}"
|
|
IGNORE_LIBRARY="${2:-false}"
|
|
|
|
if [[ "${IGNORE_LIBRARY}" == "true" ]] && HasNoShebang "${FILE}"; then
|
|
echo "${FILE} is being ignored because IGNORE_LIBRARY is set to ${IGNORE_LIBRARY}"
|
|
exit 0
|
|
fi
|
|
|
|
if ! [[ -x "${FILE}" ]]; then
|
|
echo "Error: File:[${FILE}] is not executable"
|
|
exit 1
|
|
fi
|