]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - lib.sh
Fix installed() in setup.sh on Mac OS X.
[config/dotfiles.git] / lib.sh
diff --git a/lib.sh b/lib.sh
index e222da42f00a52c7b391cecd01322b564dad6e0b..5576bce23beab7f48e6cbd989ea6c243cb04a2b5 100644 (file)
--- a/lib.sh
+++ b/lib.sh
@@ -11,6 +11,12 @@ unset LS_COLORS
 m4=`which m4`
 
 
+# Check if the given program is installed. Returns 0 if it exists, 1
+# otherwise; so it can be used in if.
+installed() {
+    which $1 | grep -E '^/' > /dev/null
+}
+
 # Creates a symbolic link for file $1 in dirname of $2 with name of basenmae
 # $2.
 #
@@ -70,4 +76,6 @@ m4() {
     # Process $1.m4 with m4 using the given options.
     echo "m4(): generating '$file' from '$file.m4' with options '$*'"
     $m4 $* $file.m4 >> $file
+
+    unset file
 }