]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - lib.sh
lib.sh: Improve installed() to work with more which.
[config/dotfiles.git] / lib.sh
diff --git a/lib.sh b/lib.sh
index da00cce8d2c9be6e4b13f77bbe638bb8718eb1de..49ce998660f3132b0b33d2bbca86e5ac936719f6 100644 (file)
--- a/lib.sh
+++ b/lib.sh
@@ -11,7 +11,7 @@ unset LS_COLORS
 # 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
+    which $1 2>&1 | perl -ne 'if (not m{^/}) { exit 1 }'
 }
 
 # Prints the current OS. Supported are Debian (debian), Gentoo (gentoo) and