made var function support multiple names.
[feisty_meow.git] / scripts / core / functions.sh
index 6d2bbe29aba4f4f15193e4e53505db6a2a4d26f0..41d94b938e9144d29218e8fa31961b8a11f2a39f 100644 (file)
@@ -33,6 +33,21 @@ if [ -z "$skip_all" ]; then
     cd "$1"
   }
 
+  # displays the value of a variable in bash friendly format.
+  function var() {
+    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()
   {
     if [ ! -z "$CLAM_FINISH_SOUND" ]; then