표준오류를 표준출력으로 돌리기

Jmnote (토론 | 기여)님의 2015년 12월 16일 (수) 17:23 판 (새 문서: ;표준오류를 표준출력으로 돌리기 ==실습== <source lang='cli'> root@zetawiki:~# ls not-exist.txt ls: cannot access not-exist.txt: No such file or directory </source> :...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)
표준오류를 표준출력으로 돌리기

1 실습

root@zetawiki:~# ls not-exist.txt
ls: cannot access not-exist.txt: No such file or directory
→ stderr로 출력된 오류 메시지
root@zetawiki:~# ls not-exist.txt > out.txt
ls: cannot access not-exist.txt: No such file or directory
root@zetawiki:~# cat out.txt
→ 파일로 저장해보면 보이지 않음
root@zetawiki:~# ls not-exist.txt 2> out.txt
root@zetawiki:~# cat out.txt 
ls: cannot access not-exist.txt: No such file or directory
2>를 넣어 파일로 저장해보면 보임

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}