Sometimes it is necessary to send the output of a script to different targets. If you want to send the output to a text but want to be able to see it on the console as well you can use the tee command.
Here is an example on how to use it in a bash script:
exec > >(tee $OUTPUTFILE)
The first line uses process substitution to create a pipe which will then be connected to a tee process. The first > is the redirection of the file descriptor(1 stands for stdout) and the second > in combination with the () does the process substitution.
The second line redirects the stderr(2) file descriptor to whatever number 1 is already redirected to.