Fix wrong evaluation of env vars

This commit is contained in:
Holger Lösken
2020-06-08 14:53:16 +02:00
parent 14c0fd89eb
commit 85161446e9

View File

@@ -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]