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 ?
which
is a shell script. You can check usingfile $(which which)
. I suspect there is astty --some-option
in a.bashrc
(or in any file read by bash on init). looks like your on AIX by the way.bash -c ls
gave theNot a terminal
error ?