I am using the fish shell and try to log stdout and stderr into two separate files and printing them in the terminal at the same time (e.g., by piping each stream to tee).

In bash I would do (see https://stackoverflow.com/a/692407/5082444):

command > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)

How can I achieve the same in the fish shell?


You can do something similar with

begin; command | tee -a stdout.log ; end ^| tee -a stderr.log >&2

with the proviso that if the first tee writes anything to stderr, it will also get logged, which is not the case with the bash version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.