Permalink
Browse files

Script to test if a binary is installed

  • Loading branch information...
1 parent 1335a6c commit 3d299e4af8e39cd5c972facf7bc96f183ca75d4b @matthewmccullough committed Jun 29, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 isappinstalled
View
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+#Ensure we have one argument specified on the CLI
+if [ -z "$1" ]; then ARG_ERR=ERR; fi
+if [ -n "$ARG_ERR" ];
+then
+ echo "Checks if an app (passed as a parameter) is installed/reachable"
+ echo " on this machine by using the 'hash' command."
+ echo "Usage: isappinstalled <appname>"
+ echo "Returns: 0 if is installed, 1 if not installed."
+ exit
+fi
+
+
+hash $1 2>&- || { echo >&2 "I require $1 but it's not installed."; exit 1; }

0 comments on commit 3d299e4

Please sign in to comment.