Korn shell 93u+
2>&1 | tee -a ${LOGFILE}
puts the output to a file. I want to add that command to each function I run. For example:
_cleanup_test 2>&1 | tee -a ${LOGFILE}
That works fine.
But I want to replace 2>&1 | tee -a ${LOGFILE} with a variable, so I made
logit='2>&1 | tee -a ${LOGFILE}'
That way I can have
_cleanup_test $logit
But when I run the .ksh it reads it as
+ _cleanup_test '2>&1' '|' tee -a '${LOGFILE}'
I even tried to escape characters and a bunch of other things. How do I have it read that variable without the single quotes?