LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   redirect errors to multiple locations (https://www.linuxquestions.org/questions/linux-software-2/redirect-errors-to-multiple-locations-4175608548/)

DexterMorgan 06-24-2017 12:42 PM

redirect errors to multiple locations
 
Hi,

I'm wondering if there's a way to run a command and get:

- stderr and stdout goes on screen.
- make a copy of everything on screen, incl stderr,stdout to history.log

- BUT also make seperate logfile containing only errors, errorlog.log.

Something like this:
ls asdf 2>errorlog.log | tee history.log

But the problem here is that the errors does not appear on screen nor in the history.log

smallpond 06-25-2017 06:42 AM

Command 2> >(tee -a errorlog.log >&1) |tee -a history.log

DexterMorgan 06-27-2017 09:37 AM

Quote:

Originally Posted by smallpond (Post 5726889)
Command 2> >(tee -a errorlog.log >&1) |tee -a history.log

Thank you! this was absolutely beautiful.


All times are GMT -5. The time now is 12:46 PM.