|
You have taken correct way. $? will give status of prev command. we can not make it with single utility to give return code and redirect output to another log file. You can do it better as,
# proc > logfile
RC=$?
tee -a <logfile> < logfile
print "$RC"
where, < <filename> is faster than cat <filename>
That is all.
|