From 85161446e999cf322952c0c4b5d0854d791cd87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Lo=CC=88sken?= Date: Mon, 8 Jun 2020 14:53:16 +0200 Subject: [PATCH] Fix wrong evaluation of env vars --- entrypoint.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2b62f946..16e9dd07 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,16 +12,9 @@ in_error() { exit 1 } -# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here. +# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this "magic" here. ie_gv() { - local line name value - set | \ - while read line; do - name=${line%=*} value=${line#*=\'} - if [ "$name" = "$1" ]; then - echo ${value%\'} - fi - done + eval "echo \$$1" } # usage: file_env VAR [DEFAULT] @@ -37,7 +30,7 @@ file_env() { in_error "Both $var and $fileVar are set (but are exclusive)" fi - local val="$def" + local val="$def" if [ "$(ie_gv ${var})" != "" ]; then val=$(ie_gv ${var}) elif [ "$(ie_gv ${fileVar})" != "" ]; then