$ cp nonexistent.txt file.txt 2> errors
    $ cat errors
    cp: cannot stat 'nonexistent.txt': No such file or directory

    리다이렉트된 내용을 파일 뒤에 추가하려면 2>> 기호를 사용한다.

    $ cp nonexistent.txt file.txt 2> errors
    $ cp another.txt file.txt 2>> errors
    $ cat errors
    cp: cannot stat 'nonexistent.txt': No such file or directory
    cp: cannot stat 'another.txt': No such file or directory

    같은 파일에 표준 출력과 표준 오류 스트림을 모두 리다이렉트하려면 &> 기호를 사용한다.

    $ echo This file exists > goodfile.txt
    $ cat goodfile.txt nonexistent.txt &> all.output
    $ cat all.output
    This file exists
    cat: nonexistent.txt: No such file or directory
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.