cshで出力リダイレクト中に「ターミナルではない」エラーが発生するのはなぜですか?

cshで出力リダイレクト中に「ターミナルではない」エラーが発生するのはなぜですか?

背景:

コマンド出力(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出力でエラーが発生しない理由です。

ベストアンサー1

おすすめ記事