[comp.unix.shell] ambiguous tty

scairns@citib.com (Scott Cairns) (03/29/91)

Any ideas on what might be causing the following to happen?

% rsh [any remote machine] pwd (or any other command)
`tty`: Ambiguous

(output from rsh command)
%

This is driving me nuts trying to find out who what or
where is generating this.  The same problem exists for
shell scripts executed from cron(8).
--
+-----------------------------------------------------------------+
| Scott Cairns			    email: scairns@bank.citib.com |
| Citibank - Treasury Systems Group				  |
| One Court Square / 27th Floor	    phone: (718) 248-5366	  |

christos@theory.tn.cornell.edu (Christos S. Zoulas) (03/29/91)

In article <1991Mar28.192420.21918@citib.com> scairns@citib.com (Scott Cairns) writes:
>Any ideas on what might be causing the following to happen?
>
>% rsh [any remote machine] pwd (or any other command)
>`tty`: Ambiguous
>
>(output from rsh command)
>%
>
>This is driving me nuts trying to find out who what or
>where is generating this.  The same problem exists for
>shell scripts executed from cron(8).

You have in your .cshrc something like:

if (`tty` == /dev/console) ....
or
set tty=`tty`

The `tty` expands to "Not a tty" in the famous globone() routine...
Unfortunately csh cannot handle multiple word word output from globone() 
and prints "Ambiguous". The simplest fix is to replace `tty` with "`tty`".

christos
-- 
+------------------------------------------------------------------------+
| Christos Zoulas         | 389 Theory Center, Electrical Engineering,   |
| christos@ee.cornell.edu | Cornell University, Ithaca NY 14853.         |
| christos@crnlee.bitnet  | Phone: (607) 255 0302 |  Fax: (607) 254 4565 |

larry@st-andy.uucp (Larry Martell) (04/11/91)

In article <1991Mar28.192420.21918@citib.com> scairns@citib.com (Scott Cairns) writes:
>Any ideas on what might be causing the following to happen?
>
>% rsh [any remote machine] pwd (or any other command)
>`tty`: Ambiguous
>
>(output from rsh command)
>%
>
>This is driving me nuts trying to find out who what or
>where is generating this.  The same problem exists for
>shell scripts executed from cron(8).

This comes from any commands in your .login or .cshrc that mess with the 
tty modes (e.g. stty). These commands should not be executed during a
non-interactve login. You can test for this by examining the "prompt" shell
variable (I'm assuming csh here):

if ( $?prompt ) then
   stty kill 
   stty dec
endif

Of course if you set your prompt to some custom string you must perform
the above test before the statement that sets your prompt.

See the description of the "prompt" variable under the "Environment Variables 
and Predefined Shell Variables" section of the csh(1) man pages.
-- 
Larry Martell
uunet!st-andy!larry
212-668-9478