Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Script to test if a binary is installed

  • Loading branch information...
commit 3d299e4af8e39cd5c972facf7bc96f183ca75d4b 1 parent 1335a6c
Matthew McCullough authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 isappinstalled
15 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; }
Please sign in to comment.
Something went wrong with that request. Please try again.