Hi,
i have the following code, to catch the whole output to log it for
debugging purposes.
> function call_ext_cmd()
> {
> logmsg2 $LOGFILE $DEBUG_FLAG "--- Begin call of $*"
> COMMAND="$*"
> [[ $BIG_DEBUG -eq 1 ]] && {
> file $COMMAND | grep -q 'Bourne-Again shell script' && {
> COMMAND="sh -x $COMMAND"
> }
> }
> FIFO="/tmp/call_ext_cmd.fifo"
> rm -f $FIFO
> mkfifo $FIFO
>
> $COMMAND &> $FIFO &
> while read FIFO_LINE;
> do
> logmsg2 $LOGFILE $DEBUG_FLAG "--- Call of `basename $1`: $FIFO_LINE"
> done < $FIFO
>
> rm -f $FIFO
> logmsg2 $LOGFILE $DEBUG_FLAG "--- End call of `basename $1`"
return EXITCODEOF$COMMAND
> }
I want to catch the exit code of $COMMAND. How can i do this?
How should "return EXITCODEOF$COMMAND" be written?
Thanks a lot
D.Laurenz
