made var function support multiple names.
authorFred T. Hamster <fred@gruntose.com>
Thu, 13 Feb 2014 19:48:45 +0000 (14:48 -0500)
committerFred T. Hamster <fred@gruntose.com>
Thu, 13 Feb 2014 19:48:45 +0000 (14:48 -0500)
scripts/core/functions.sh

index bc2d1cabf88840ecfa0cb91401eb8e27e083f2de..41d94b938e9144d29218e8fa31961b8a11f2a39f 100644 (file)
@@ -35,12 +35,17 @@ if [ -z "$skip_all" ]; then
 
   # displays the value of a variable in bash friendly format.
   function var() {
-    local varname="$1"; shift
-    if [ -z "${!varname}" ]; then
-      echo "$varname undefined"
-    else
-      echo "$varname=${!varname}"
-    fi
+    while true; do
+      local varname="$1"; shift
+      if [ -z "$varname" ]; then
+        break
+      fi
+      if [ -z "${!varname}" ]; then
+        echo "$varname undefined"
+      else
+        echo "$varname=${!varname}"
+      fi
+    done
   }
 
   function success_sound()