From a5a1c4d50da36b24dde58d86cc7a1d2f5a2e1182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 23 Apr 2020 08:14:56 +0300 Subject: [PATCH] Make work in set -u (nounset) mode --- libexec/rbenv-sh-shell | 4 ++-- test/shell.bats | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/rbenv-sh-shell b/libexec/rbenv-sh-shell index 8c71185..c44c74f 100755 --- a/libexec/rbenv-sh-shell +++ b/libexec/rbenv-sh-shell @@ -49,7 +49,7 @@ if [ "$version" = "--unset" ]; then echo "set -e RBENV_VERSION" ;; * ) - echo 'RBENV_VERSION_OLD="$RBENV_VERSION"' + echo 'RBENV_VERSION_OLD="${RBENV_VERSION-}"' echo "unset RBENV_VERSION" ;; esac @@ -107,7 +107,7 @@ if rbenv-prefix "$version" >/dev/null; then echo "set -gx RBENV_VERSION \"$version\"" ;; * ) - echo 'RBENV_VERSION_OLD="$RBENV_VERSION"' + echo 'RBENV_VERSION_OLD="${RBENV_VERSION-}"' echo "export RBENV_VERSION=\"$version\"" ;; esac diff --git a/test/shell.bats b/test/shell.bats index bbb146e..38b0f42 100644 --- a/test/shell.bats +++ b/test/shell.bats @@ -47,7 +47,7 @@ load test_helper RBENV_SHELL=bash run rbenv-sh-shell --unset assert_success assert_output <