[13176] in Athena Bugs

home help back first fref pref prev next nref lref last post

rsaix 7.7J: tcsh

daemon@ATHENA.MIT.EDU (Dan Christensen)
Fri Feb 3 15:45:53 1995

To: bugs@MIT.EDU
Date: Fri, 03 Feb 1995 15:45:44 EST
From: Dan Christensen <jdchrist@MIT.EDU>

System name:		m2-225-13
Type and version:	POWER 7.7J
Display type:		POWER_Gt1

What were you trying to do?  

  Use the prompt variable to determine whether the shell is getting its
  input from a terminal.

What's wrong:

  /bin/csh (which is the tcsh) seems to always initially set the prompt
  variable to "% ".  The following shows an example of the problem:
  
    m2-225-8[212]% cat test.csh 
    if ($?prompt) then
      echo "Prompt is $prompt."
    
      stty erase ^h
    endif
    m2-225-8[213]% /bin/csh -f < test.csh
    Prompt is % .
    stty: TXGETLD: Not a typewriter
    m2-225-8[214]% 

  The input to /bin/csh was not interactive, but nevertheless the prompt
  was set and stty gives an error.  How can this be avoided?  The same
  thing happens if in addition the output is sent to a file.  (Note 
  that the -f flag tells csh to ignore my dotfiles, so the prompt
  isn't being set there.)

  A consultant said:

    My opinion is that this is a bug in tcsh.  It should not be used to replace
    csh, as there are many books and scripts that use just what you are trying
    to use.  This is pathological behavior.  Run sendbug.
  
    While you're at it, tell them tcsh still fails to set the echo mode when 
    you ctrl-Z out of olcr....

  I like tcsh in general, so I'd like to continue using it, but I
  would like a reliable way to tell if stty is going to crap out on
  me.

What should have happened:

  The prompt shouldn't be set unless the shell is getting its input from
  the terminal.

Please describe any relevant documentation references:

  Line 67 of the csh man page.

home help back first fref pref prev next nref lref last post