aboutsummaryrefslogtreecommitdiffstats
path: root/lib/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/functions.sh')
-rw-r--r--lib/functions.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/functions.sh b/lib/functions.sh
new file mode 100644
index 0000000..99a8962
--- /dev/null
+++ b/lib/functions.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+function has()
+{
+ local command_name="${1}"; shift;
+
+ set +o errexit
+ hash "${command_name}" > /dev/null 2>&1;
+ if [ 0 -eq ${?} ];
+ then
+ set -o errexit
+ return 0;
+ fi
+
+ set -o errexit
+ return 1;
+}
+