[gtk-osx: 16/48] Fix dereferencing of _varname in envvar().



commit 3ad0e7f6e82554de41f0279e1aaa9ca2d49394a5
Author: John Ralls <jralls ceridwen us>
Date:   Mon Apr 8 11:26:25 2019 -0700

    Fix dereferencing of _varname in envvar().

 gtk-osx-setup.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gtk-osx-setup.sh b/gtk-osx-setup.sh
index 4d86bde..b18e1ee 100755
--- a/gtk-osx-setup.sh
+++ b/gtk-osx-setup.sh
@@ -28,11 +28,13 @@
 envvar ()
 {
     local _varname=$1
-    if test -z "`eval echo '"$'"$_varname"'"'`"; then
-        eval "export $_varname"'="'"$2"'"'
+    eval local _var=\$$_varname
+    if test -z "$_var"; then
+        eval export $_varname="$2"
+        _var=$2
     fi
-    if test ! -d "`eval echo '"$'"$_varname"'"'`"; then
-        eval "mkdir -p $_varname"
+    if test ! -d "$_var"; then
+        mkdir -p "$_var"
     fi
 }
 # Environment variable defaults:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]