Does redirecting to /dev/tty work if the original stdout of the shell was NOT a tty? This script runs as a cron job so it has no tty.
Also is there a better way to save the original stdout and switch back to it
than this:
trap "cat $LOG > &3" ERR
{
foo
bar
} 3>&1 > /dev/null
Chet Ramey wrote:
The ERR trap is handled in the context in which the shell is currently
running. If you want to display the log file on the terminal when the
ERR trap is run, you can either save the original stdout and make the
trap command (the `cat $LOGFILE') redirect its stdout there, or you can
redirect the trap command's standard output directly to /dev/tty.
Chet
_______________________________________________
Bug-bash mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-bash