elog_add_command directly to screen

This commit is contained in:
Daniel Pätzold
2026-03-16 12:16:04 +01:00
parent fe8c7f1724
commit a7bd9ba054
+4 -4
View File
@@ -41,15 +41,15 @@ elog_add() {
echo $@ | tee ${LOGFILE} -a
}
elog_add_command() {
#Run a command, capture output (STD and ERR) to the logfile AND in variable RETTXT AND output to screen
#Run a command, capture output (STD and ERR) to the logfile AND output to screen
# WILL NOT SET RETTXT to make Output directly to screen
#Returns the exit value of the command in $? and in RETNO
RETTXT=$( $@ > >(tee -a ${LOGFILE}) 2>&1 )
$@ | tee -a ${LOGFILE}
RETNO=$?
echo "${RETTXT}"
return ${RETNO}
}
elog_add_command_subshell() {
# Special Version of above, where the command will be completely executed in a subshell. This is needed for some commands, that may output to
# Special Version of above, where the command will be completely executed in a subshell and then passed to Variable RETTXT. This is needed for some commands, that may output to
# something else than STD or ERR and otherwise cannot be captured completely.
# Benefit: Really catch everything that is send to output
# Disadvantage: Output wont't display directly, but only after finshed execution