pkgs/stdenv/generic/setup.sh: lint with ShellCheck (#351849)

This commit is contained in:
Philip Taron 2024-11-01 08:52:44 -07:00 committed by GitHub
commit f2b00cb5ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,7 @@ shopt -s inherit_errexit
# $NIX_DEBUG must be a documented integer level, if set, so we can use it safely as an integer.
# See the `Verbosity` enum in the Nix source for these levels.
if ! [[ -z ${NIX_DEBUG-} || $NIX_DEBUG == [0-7] ]]; then
# shellcheck disable=SC2016
printf 'The `NIX_DEBUG` environment variable has an unexpected value: %s\n' "${NIX_DEBUG}"
echo "It can only be unset or an integer between 0 and 7."
exit 1
@ -396,7 +397,7 @@ concatTo() {
for arg in "$@"; do
IFS="=" read -r name default <<< "$arg"
local -n nameref="$name"
if [[ ! -n "${nameref[@]}" && -n "$default" ]]; then
if [[ -z "${nameref[*]}" && -n "$default" ]]; then
targetref+=( "$default" )
elif type=$(declare -p "$name" 2> /dev/null); then
case "${type#* }" in