I have a bash script where I'm redirecting output into a file for logging.
if test -t 1; then
# stdout is a terminal
exec > $OUTPUT_FILE 2>&1
else
# stdout is not a terminal, no logging.
false
fi
I have one spot later where I actually need output to go to stdout. Is there a way to override just one call to force that?
echo test 1>
tail -f $OUTPUT_FILE
?