gaboshlib/gaboshlib/g_runcmd.bashfunc

16 lines
281 B
Plaintext
Raw Normal View History

#!/bin/bash
function g_runcmd {
set -o pipefail
#>&2 echo "running $@"
$@ 2>&1 | tee $g_tmp/g_runcmd-output
g_runcmd_exitcode=$?
2022-12-01 10:29:21 +01:00
if ! [ $g_runcmd_exitcode -eq 0 ]
then
2023-01-17 10:30:16 +01:00
g_echo_error "${FUNCNAME} $@
$(cat $g_tmp/g_runcmd-output)"
fi
return $g_runcmd_exitcode
}