![Fish Shell에서 stdout 및 stderr을 인쇄하고 기록합니다.](https://linux55.com/image/135786/Fish%20Shell%EC%97%90%EC%84%9C%20stdout%20%EB%B0%8F%20stderr%EC%9D%84%20%EC%9D%B8%EC%87%84%ED%95%98%EA%B3%A0%20%EA%B8%B0%EB%A1%9D%ED%95%A9%EB%8B%88%EB%8B%A4..png)
나는 fish
쉘을 사용하고 있으며 stdout과 stderr을 두 개의 개별 파일에 기록하고 동시에 터미널에서 인쇄하려고 합니다(예를 들어 각 스트림을 tee
.
나는 bash
할 것이다 (참조https://stackoverflow.com/a/692407/5082444):
command > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)
fish
셸에서 동일한 목표를 어떻게 달성할 수 있나요 ?
답변1
당신은 다음과 같은 것을 할 수 있습니다
begin; command | tee -a stdout.log ; end ^| tee -a stderr.log >&2
단, 첫 번째 항목이 tee
stderr에 무엇이든 쓰면 기록도 남게 되는데, 이는 bash 버전의 경우에는 해당되지 않습니다.