diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index f22da254a791..a7b2b110f23f 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -89,7 +89,7 @@ patchShebangs() { if [[ "$oldPath" == *"/bin/env" ]]; then if [[ $arg0 == "-S" ]]; then arg0=${args%% *} - args=${args#* } + [[ "$args" == *" "* ]] && args=${args#* } || args= newPath="$(PATH="${!pathName}" type -P "env" || true)" args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args"