I want to redirect some output of a script to a file.
REDIRECT_FILE="foo.txt" echo to console # starting redirect exec > $REDIRECT_FILE echo to file echo ... echo ... # stop redirect exec >&- echo end of script
"end of script" should be written to stdout. But instead there is a "Bad file descriptor" error message.
exec 1>&- does not work too.
What is the correct term to stop the redirection?