From 0eb40e10a25570ba34a9ff8116c39c86a97474a2 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Mon, 7 Sep 2020 10:32:22 -0400 Subject: [PATCH] Make emsdk_env.sh work under set -o nounset (#605) Closes emscripten-core/emscripten#6743 --- emsdk_env.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/emsdk_env.sh b/emsdk_env.sh index 7341255..8f76de7 100644 --- a/emsdk_env.sh +++ b/emsdk_env.sh @@ -31,15 +31,15 @@ DIR="." # To add a shell, add another conditional below, # then add tests to scripts/test_source_env.sh -if [ -n "$BASH_SOURCE" ]; then +if [ -n "${BASH_SOURCE-}" ]; then CURRENT_SCRIPT="$BASH_SOURCE" -elif [ -n "$ZSH_VERSION" ]; then +elif [ -n "${ZSH_VERSION-}" ]; then CURRENT_SCRIPT="${(%):-%x}" -elif [ -n "$KSH_VERSION" ]; then +elif [ -n "${KSH_VERSION-}" ]; then CURRENT_SCRIPT=${.sh.file} fi -if [ -n "$CURRENT_SCRIPT" ]; then +if [ -n "${CURRENT_SCRIPT-}" ]; then DIR=$(dirname "$CURRENT_SCRIPT") if [ -h "$CURRENT_SCRIPT" ]; then # Now work out actual DIR since this is part of a symlink.