elog_add_command directly to screen
This commit is contained in:
@@ -41,15 +41,15 @@ elog_add() {
|
|||||||
echo $@ | tee ${LOGFILE} -a
|
echo $@ | tee ${LOGFILE} -a
|
||||||
}
|
}
|
||||||
elog_add_command() {
|
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
|
#Returns the exit value of the command in $? and in RETNO
|
||||||
RETTXT=$( $@ > >(tee -a ${LOGFILE}) 2>&1 )
|
$@ | tee -a ${LOGFILE}
|
||||||
RETNO=$?
|
RETNO=$?
|
||||||
echo "${RETTXT}"
|
|
||||||
return ${RETNO}
|
return ${RETNO}
|
||||||
}
|
}
|
||||||
elog_add_command_subshell() {
|
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.
|
# something else than STD or ERR and otherwise cannot be captured completely.
|
||||||
# Benefit: Really catch everything that is send to output
|
# Benefit: Really catch everything that is send to output
|
||||||
# Disadvantage: Output wont't display directly, but only after finshed execution
|
# Disadvantage: Output wont't display directly, but only after finshed execution
|
||||||
|
|||||||
Reference in New Issue
Block a user