added var function to print out variable values.
[feisty_meow.git] / scripts / core / functions.sh
index 6d2bbe29aba4f4f15193e4e53505db6a2a4d26f0..bc2d1cabf88840ecfa0cb91401eb8e27e083f2de 100644 (file)
@@ -33,6 +33,16 @@ if [ -z "$skip_all" ]; then
     cd "$1"
   }
 
+  # 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
+  }
+
   function success_sound()
   {
     if [ ! -z "$CLAM_FINISH_SOUND" ]; then