![csh에서 출력 리디렉션 중에 "터미널이 아님" 오류가 발생하는 이유는 무엇입니까?](https://linux55.com/image/220910/csh%EC%97%90%EC%84%9C%20%EC%B6%9C%EB%A0%A5%20%EB%A6%AC%EB%94%94%EB%A0%89%EC%85%98%20%EC%A4%91%EC%97%90%20%22%ED%84%B0%EB%AF%B8%EB%84%90%EC%9D%B4%20%EC%95%84%EB%8B%98%22%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%95%98%EB%8A%94%20%EC%9D%B4%EC%9C%A0%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
배경:
명령 출력(stdout 및 stderr) 중 일부를 csh
셸 아래의 동일한 파일에 넣었습니다.
질문:
다음 리디렉션 헤더에 "터미널이 아님" 메시지가 표시되는 이유는 무엇입니까?
> which brarchive
/home/ewpadm/brtools/brarchive
>
>
> which brarchive >& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
>
>
> ls -l Ac >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
>
>
> (which pwd; ls -l Fc) >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
>
>
> (which tar; file /etc/passwd) >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
Not a terminal
/usr/bin/tar
/etc/passwd: ascii text
>
>
> (which ntpq; head -1 /etc/ntp.conf) >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
Not a terminal
/usr/bin/tar
/etc/passwd: ascii text
Not a terminal
which: 0652-141 There is no ntpq in /oracle/EWP/112_64/bin /usr/bin /etc /usr/sbin /usr/ucb /home/ewpadm/bin /usr/bin/X11 /sbin . /usr/sap/EWP/SYS/exe/uc/rs6000_64 /usr/sap/EWP/SYS/exe/run /home/ewpadm /home/ewpadm/brtools.
# @(#)48 1.2 src/tcpip/etc/ntp.conf, ntp, tcpip610 2/16/96 10:16:34
>
>
> ls -l Ac >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
Not a terminal
/usr/bin/tar
/etc/passwd: ascii text
Not a terminal
which: 0652-141 There is no ntpq in /oracle/EWP/112_64/bin /usr/bin /etc /usr/sbin /usr/ucb /home/ewpadm/bin /usr/bin/X11 /sbin . /usr/sap/EWP/SYS/exe/uc/rs6000_64 /usr/sap/EWP/SYS/exe/run /home/ewpadm /home/ewpadm/brtools.
# @(#)48 1.2 src/tcpip/etc/ntp.conf, ntp, tcpip610 2/16/96 10:16:34
ls: 0653-341 The file Ac does not exist.
>
>
> (ls -l Ac; file /etc/passwd) >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
Not a terminal
/usr/bin/tar
/etc/passwd: ascii text
Not a terminal
which: 0652-141 There is no ntpq in /oracle/EWP/112_64/bin /usr/bin /etc /usr/sbin /usr/ucb /home/ewpadm/bin /usr/bin/X11 /sbin . /usr/sap/EWP/SYS/exe/uc/rs6000_64 /usr/sap/EWP/SYS/exe/run /home/ewpadm /home/ewpadm/brtools.
# @(#)48 1.2 src/tcpip/etc/ntp.conf, ntp, tcpip610 2/16/96 10:16:34
ls: 0653-341 The file Ac does not exist.
ls: 0653-341 The file Ac does not exist.
/etc/passwd: ascii text
>
>
> (file /etc/passwd; ls -l Ac) >>& t_0
>
>
> cat t_0
Not a terminal
/home/ewpadm/brtools/brarchive
ls: 0653-341 The file Ac does not exist.
Not a terminal
/usr/bin/pwd
ls: 0653-341 The file Fc does not exist.
Not a terminal
/usr/bin/tar
/etc/passwd: ascii text
Not a terminal
which: 0652-141 There is no ntpq in /oracle/EWP/112_64/bin /usr/bin /etc /usr/sbin /usr/ucb /home/ewpadm/bin /usr/bin/X11 /sbin . /usr/sap/EWP/SYS/exe/uc/rs6000_64 /usr/sap/EWP/SYS/exe/run /home/ewpadm /home/ewpadm/brtools.
# @(#)48 1.2 src/tcpip/etc/ntp.conf, ntp, tcpip610 2/16/96 10:16:34
ls: 0653-341 The file Ac does not exist.
ls: 0653-341 The file Ac does not exist.
/etc/passwd: ascii text
/etc/passwd: ascii text
ls: 0653-341 The file Ac does not exist.
>
>
이제 이 오류 메시지는 >&의 stderr 출력을 통해서만 얻을 수 있음을 확인할 수 있습니다.
>
> which ssh > t_1
>
>
> cat t_1
/usr/bin/ssh
>
>
> (which ssh > t_1) >& t_2
>
>
> cat t_1
/usr/bin/ssh
>
>
> cat t_2
Not a terminal
>
그래서 제 질문은 ">&"를 통한 stderr 출력에서만 오류가 발생하고 ">"를 통한 stderr 출력에서는 오류가 발생하지 않는 이유입니다.