+run() {
+ # Usage: run [cmd]
+ # Description: Runs command; reports success if command exit code 0; exits otherwise.
+ # Input: none
+ # Output: stdout
+ # Script function dependencies: none
+ # Last modified: 2020-06-19T22:09Z
+ # Last modified by: Steven Baltakatei Sandoval
+ # License: GPLv3+
+ # Ref.Attrib: https://stackoverflow.com/a/18880585
+ cmd_output=$(eval $1)
+ return_value=$?
+ if [ $return_value != 0 ]; then
+ echo "Command $1 failed";
+ exit -1;
+ else
+ echo "output: $cmd_output";
+ echo "Command succeeded.";
+ fi
+ return $return_value
+} #