[Eug-lug] No value for $TERM

Allen Brown allen_brown at agilent.com
Thu Jan 20 13:47:36 PST 2005


I don't call stty or tputs from .bashrc or /etc/profile.
I call stty once in .bash_profile, and tputs not at all.
It is done this way:
   [[ -z ${VUE-} && -z ${DT-} && "${TERM}" != "dumb" ]] && stty kill "^U

The only one of these files that has the right pattern of
stty+tputs+tputs is /etc/bashrc.  It is done this way:
if [ -n "${PS1-}"  -a  -n "${TERM-}" ]; then
   All terminal related stuff such as stty and tputs
fi

/etc/bashrc loads /etc/profile if that hasn't happened yet.
So moving this to /etc/profile won't solve the problem.
I don't want to give up profile loading because lots of things
will be very stupid without a profile.
What I need to do is to make the conditionals around the
terminal related stuff to work.
I will try using a conditional like this:

if [ -n "${PS1-}"  -a  -n "${TERM-}"  -a  "${TERM-}" != "dumb" ]; then
   All terminal related stuff such as stty and tputs
fi
-- 
Allen Brown
   work: Agilent Technologies      non-work: http://www.peak.org/~abrown/
         allen_brown at agilent.com	            abrown at peak.org
   If all economists were laid end to end,
   they would not reach a conclusion. ---George Bernard Shaw


Bob Miller wrote:
> Allen Brown wrote:
> 
> 
>>stty: standard input: Invalid argument
>>tput: No value for $TERM and no -T specified
> 
> 
> Remove tput and stty from ~/.bashrc and move it to ~/.bash_profile.
> Then it will only be executed for login shells.
> 
> You can look at this info page for a more detailed description of
> which files are loaded under which conditions.
> 
> 	"(bash.info.gz)Bash Startup Files"
> 
> Anything that requires a (pseudo)terminal should only be done in an
> interactive shell, and anything that initializes a terminal (such
> as stty and tput) should only be done for login shells.
> 


More information about the EUGLUG mailing list