I have a bash script that I am working on, each line can have output and error. I am trying to send all output to a file and error to a different file.
My goal is to have a report at the end that I can make use of and in case of problems I would view my error report.
Now the way I am doing this is like this
And in every line I do this
some syntax > $R 2> $E
I find this too much consuming and not professional. Is there a way to generalize this. I mean is there a way to tell the script to send any output to $R and any error to $E at the begining of the script or do I have to do this in each line.
I am aware that while running the script I can do a > somefile and 2> someotherfile.
I would like to have this inside the script.