From 04d073329a15ad7b3be6f6da84e90a89181b96b6 Mon Sep 17 00:00:00 2001 From: Devon Mackay Date: Fri, 6 Jul 2018 13:07:45 -0400 Subject: [PATCH] Add file with general helper functions for use by other scripts --- script/include/helper_functions.inc.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 script/include/helper_functions.inc.sh diff --git a/script/include/helper_functions.inc.sh b/script/include/helper_functions.inc.sh new file mode 100644 index 00000000..18968aae --- /dev/null +++ b/script/include/helper_functions.inc.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# helper_functions.inc.sh: General helper functions + +# Check pip to see if the given package is installed +# (returns 0 if installed, 2 if not installed) +check_pip_for () { + return $(pip list --format=columns --disable-pip-version-check | \ + grep -Fe "${1}" >/dev/null 2>&1) +}