dev/bash/functions/functions.sh

16 lines
234 B
Bash
Raw Normal View History

#!/bin/bash
function run_cmd()
{
err_code=$(($err_code+1))
if [[ "$1" == "" ]]; then
echo "Error:Need command to run_cmd() function!"
exit -1
fi
$1
if [[ "$?" != "0" ]]; then
echo \"$1\" error >&2
exit $err_code
fi
}