Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '$?TERM_PROGRAM' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
$?TERM_PROGRAM
Authored by: kholburn on Oct 03, '02 07:35:51AM

Changing
if ("$TERM_PROGRAM" == "Apple_Terminal") then
to:
if ("$?TERM_PROGRAM" == "Apple_Terminal") then
will not give an error but it changes the meaning. $?TERM_PROGRAM is a number 0 or 1 depending on whether the variable $TERM_PROGRAM exists or not. It can never equal "Apple_Terminal" so you may as well comment the if statement out:
# if ("$TERM_PROGRAM" == "Apple_Terminal") then
# alias settermtitle 'echo -n "^[]2;\!:1^G"'
# endif

Or you can correct the script by enclosing the if statement in another :
if ( $?TERM_PROGRAM ) then
if ("$TERM_PROGRAM" == "Apple_Terminal") then
alias settermtitle 'echo -n "^[]2;\!:1^G"'
endif
endif

You have to enclose it because tcsh doesn't shortcut boolean expressions in "if" statements - if you put :
if ( $?TERM_PROGRAM && "$TERM_PROGRAM" == "Apple_Terminal")
tcsh would try to evaluate both parts (which bash or sh would not do) and would fail when the $TERM_PROGRAM variable doesn't exist.

Actually this line causes my terminal windows to have their title renamed to \!: which I don't like much so I think commenting out is better.



[ Reply to This | # ]