I am looking for a
bash command where I can redirect:
- stdout of a command to a file
- stderr to both that file and the console.
I have found ways where the stderr will append to the end of the file after the stdout, but I want it so that the output file orders all out the output chronologically like it would if I were to just use
command &> file.
I have tried:
command 2>&1 1>logfile | tee -a logfile command 2> >(tee -a logfile) 1>>logfile
I would basically like the output file to be same as if I simply did
command &> logfile, whilst at the same time keep printing stderr messages to the console.