![bash에서 stdin, stdout 및 stderr을 동시에 리디렉션하는 방법은 무엇입니까? [복사]](https://linux55.com/image/120713/bash%EC%97%90%EC%84%9C%20stdin%2C%20stdout%20%EB%B0%8F%20stderr%EC%9D%84%20%EB%8F%99%EC%8B%9C%EC%97%90%20%EB%A6%AC%EB%94%94%EB%A0%89%EC%85%98%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F%20%5B%EB%B3%B5%EC%82%AC%5D.png)
stdin
리디렉션 과 stdout
동시에 stderr
참여하고 싶습니다 bash
. 방법은 다음과 같습니다.
someProgram < stdinFile.txt > stdoutFile.txt 2> stderrFile.txt
답변1
예, 다음과 같은 구문이 쉘이 실제로 수행하는 작업에 더 가깝지만 구문은 정확합니다.
< stdinFile.txt > stdoutFile.txt 2> stderrFile.txt command arguments
리디렉션에 사용되는 파일은 명령이 시작되기 전에 열리고 첫 번째 단계가 실패하면 명령이 시작되지 않습니다.