„gaboshlib/g_runcmd.bashfunc“ ändern

This commit is contained in:
olli 2022-12-01 15:01:42 +01:00
parent 94cc0f01ef
commit a5d5169992

View File

@ -1,15 +1,15 @@
#!/bin/bash
function g_runcmd {
set -o pipefail
g_echo "running $@"
$@ 2>&1 | tee $g_tmp/g_runcmd-output
$@ 2>&1 | tee $g_tmp/g_runcmd-output
g_runcmd_exitcode=$?
if [ $g_runcmd_exitcode -eq 0 ]
if ! [ $g_runcmd_exitcode -eq 0 ]
then
g_echo_ok "$@"
else
g_echo_error "$@"
g_echo_error "# $@
$(cat $g_tmp/g_runcmd-output)"
fi
return $g_runcmd_exitcode
}