0

Background:

We have put some command outputs (both stdout and stderr) into the same file under the csh shell.

Question:

Why do we get the "Not a terminal" message in the following redirection header?

> 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.
> 
> 


Now I can confirm that this error messages was just gotten only with the which stderr output via >& .
>
> 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                            
>  

So my question is why only the which stderr output via ">&" would produce the error, versus the which stdout via ">" not ?

6
  • On my (ubuntu) system which is a shell script. You can check using file $(which which). I suspect there is a stty --some-option in a .bashrc (or in any file read by bash on init). looks like your on AIX by the way.
    – Archemar
    Commented May 30, 2023 at 13:04
  • Yes, but it has nothing to do with the "which" command itself.
    – lylklb
    Commented May 31, 2023 at 12:36
  • do bash -c ls gave the Not a terminal error ?
    – Archemar
    Commented May 31, 2023 at 12:41
  • No, so it is a bit strange ...
    – lylklb
    Commented May 31, 2023 at 12:48
  • Very sorry! It is indeed my mistaken. Please see my above update.
    – lylklb
    Commented Jun 6, 2023 at 12:41

0

You must log in to answer this question.

Browse other questions tagged .