write output to file if error bash code example
Example: bash script output and error to file
command1 > everything.txt 2>&1
command1 -arg > everything.txt 2>&1
command1 > everything.txt 2>&1
command1 -arg > everything.txt 2>&1