LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-22-2004, 12:07 PM   #1
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
$TERM variable change, or other solution?


This seems like it might end up being a lengthy post, but I'll try to be as brief as possible without being too vague....

My situation is as follows:
I have a weird PS1, something I was messing around with for a while just to make it funky. It has many escaped characters (line characters), which usually display fine...except when I use Midnight Commander. Only the last few characters display, and they are not escaped, so it's something like 0qm(B> or something similar.

I've tried to find a solution to this, and so far the best option I've found is to change the term name of aterm when it launches mc, "aterm -tn vt220 -e mc", and place something like this in ~/.bashrc:
Code:
if [ $TERM = vt220 ]; then
    PS1='\@ \u > '
else
    PS1='<very long string of characters>'
fi
This seems to work ok in X, since all my other terminal apps automatically reset $TERM to "xterm". However, when I'm working in tty, the $TERM variable remains "vt220" until I manually return it to "linux".

I have 3 questions relating to this:

1) Am I likely to run into trouble (apps not running properly, etc) by leaving $TERM=vt220 while I'm in tty?

2) Is there another term name that might be more appropriate? Linux doesn't work properly...in X mc displays its borders all funky, and in tty it would display the shortened PS1 all the time (my $TERM is already "linux" in tty).

3) Is there an altogether better solution to this? By "this" I mean finding out whether mc is the application which is currently being opened, and setting PS1 accordingly.


I'm running SuSE 9, kernel 2.4.21-99, bash 2.05b, and generally aterm in X

Thanks for any help.
 
Old 01-22-2004, 12:57 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
Have a look at
man bash

The difference is that .bashrc is for non-login
shells, but the full-screen terminals are LOGIN
shells ... if you want the setting changed there
just source the .bashrc from .bash_login.


Cheers,
Tink
 
Old 01-22-2004, 06:38 PM   #3
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Original Poster
Rep: Reputation: 45
I have .bashrc sourced from .bash_profile, so the changes are made in the login shells. I'm just concerned if it may cause problems, or I may lose some functionality, by switching to a different $TERM. I did lose the ability to select mc menu items with the mouse, but I kinda prefer it that way.
 
Old 01-22-2004, 09:32 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
You mean one can use a mouse with mc? :D


Cheers,
Tink
 
Old 01-22-2004, 10:08 PM   #5
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Original Poster
Rep: Reputation: 45
Yeah.....if it's in X on a terminal that supports mouse action. I started out using mc in eterm, then when I switched to aterm I got confused...when I'd click on mc to focus it, I'd get drop-down menus or else select whatever file was under the cursor. I prefer it without the mouse support.

So far it seems to cause absolutely no trouble in X to be switching the term variable every time I open mc, but I haven't spent much time in a tty today to see if there's an issue there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scp error, TERM env. variable not set? jimbo Linux - Networking 2 11-26-2005 02:31 AM
change font in virtual term grexk Ubuntu 2 05-26-2005 05:14 AM
Cron: TERM environment variable not set. hydro Linux - General 4 04-15-2004 11:59 PM
$TERM Variable Problems LinuxTechie Red Hat 2 11-02-2003 11:29 AM
I cannot change my PATH$ variable KptnKrill Linux - Newbie 6 08-17-2003 04:03 PM


All times are GMT -5. The time now is 07:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration