I am writing some testing scripts and want to catch all error output and write it to an error log as well as all regular output and write that to a separate log. I am using a command of the form
cmd > output.file 2> error.file
The command I am writing test scripts for can cause a segmentation fault. When the command segfaults, bash still prints out segmentation fault to the terminal.
I want this to not happen or get redirected along with standard error.
Is it possible? It must be of bash's doing because both output streams are being redirected.
bash -c 'cmd >output.file 2>error.file' >bash_output.file 2>&1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With