You are not logged in.

#1 2011-07-22 00:43:30

sensory
Member
From: UK
Registered: 2010-05-01
Posts: 40

How can I make sure that export TERM=rxvt-unicode is working?

Is there a command I can run to make sure that my entry to export my default terminal as "rxvt-unicode" is working?

I've recently updated urxvt to another package and I'd like to know that my export is working as it should.

Offline

#2 2011-07-22 00:48:41

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: How can I make sure that export TERM=rxvt-unicode is working?

Run "echo $TERM"?

Offline

#3 2011-07-22 00:53:34

sensory
Member
From: UK
Registered: 2010-05-01
Posts: 40

Re: How can I make sure that export TERM=rxvt-unicode is working?

What I mean is, how do I know the export is working for what it is intended? How can I figure out that "export TERM=rxvt-unicode" is actually doing its job?

e.g. opening a URL from the terminal shows that that "export BROWSER=firefox" is doing its job because it opens the URL in Firefox.

Last edited by sensory (2011-07-22 00:54:13)

Offline

#4 2011-07-22 01:00:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How can I make sure that export TERM=rxvt-unicode is working?

Why do you export it? Do you want to do something that expects $TERM to be rxvt-unicode?

[karol@black ~]$ echo $BROWSER
/usr/bin/firefox

It's just a variable so it gets substituted by the shell when interpreting the command you gave.
If /usr/bin/firefox is a symbolic link to e.g. chromium, the url will open in chromium, but the $BROWSER variable works OK.

Last edited by karol (2011-07-22 01:04:38)

Offline

#5 2011-07-22 12:44:38

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How can I make sure that export TERM=rxvt-unicode is working?

sensory wrote:

Is there a command I can run to make sure that my entry to export my default terminal as "rxvt-unicode" is working?

I've recently updated urxvt to another package and I'd like to know that my export is working as it should.

Do not do this, never export TERM ever.

Just throw "URxvt*termName: rxvt-unicode-256color" or similar into your ~/.Xdefaults instead.

As for seeing if it works:

lucke wrote:

Run "echo $TERM"?

Last edited by Mr.Elendig (2011-07-22 12:46:01)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2011-07-22 14:11:59

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How can I make sure that export TERM=rxvt-unicode is working?

Mr.Elendig wrote:

As for seeing if it works:

lucke wrote:

Run "echo $TERM"?

Of course, that's not exactly a sufficient condition.

$ unset i
$ i=hello
$ echo $i
hello
$ bash <(echo echo \$i)

$ export i
$ bash <(echo echo \$i)
hello

Just to clarify a bit...


This silver ladybug at line 28...

Offline

#7 2011-07-22 15:08:14

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: How can I make sure that export TERM=rxvt-unicode is working?

lolilolicon wrote:
Mr.Elendig wrote:

As for seeing if it works:

lucke wrote:

Run "echo $TERM"?

Of course, that's not exactly a sufficient condition.

$ unset i
$ i=hello
$ echo $i
hello
$ bash <(echo echo \$i)

$ export i
$ bash <(echo echo \$i)
hello

Just to clarify a bit...

...and the point of this exercise is that child processes don't inherit environment vars which aren't exported. So the proper check might be:

$ declare -p TERM  # bash specific
declare -x TERM="rxvt-unicode-256color"

$ grep -z ^TERM= /proc/self/environ # shell agnostic

The '-x' flag is what you're looking for in the Bash case.

Last edited by falconindy (2011-07-22 15:09:01)

Offline

#8 2011-07-22 15:49:18

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How can I make sure that export TERM=rxvt-unicode is working?

falconindy wrote:

...and the point of this exercise is that child processes don't inherit environment vars which aren't exported. So the proper check might be:

$ declare -p TERM  # bash specific
declare -x TERM="rxvt-unicode-256color"

The '-x' flag is what you're looking for in the Bash case.

For exports, `export -p' also does the job. e.g.,

$ export -p | grep 'declare -x TERM'

`export -p' is a little more accurate in that it also reports a exported environment variable even f it's not set a value.
> Edit: Hmm, `declare -p' without an operand does also report the such environment variables too. Oh well.

falconindy wrote:
$ grep -z ^TERM= /proc/self/environ # shell agnostic

Although this is totally weird and uses an external program, I admire you.

Last edited by lolilolicon (2011-07-22 16:00:53)


This silver ladybug at line 28...

Offline

#9 2011-07-22 16:30:40

sensory
Member
From: UK
Registered: 2010-05-01
Posts: 40

Re: How can I make sure that export TERM=rxvt-unicode is working?

Mr.Elendig wrote:

Do not do this, never export TERM ever.

Why shouldn't I export TERM? I've always been told the opposite.

Thanks for all the replies; I'll check out all your suggestions when I'm at my computer. smile

Offline

#10 2011-07-22 16:58:58

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How can I make sure that export TERM=rxvt-unicode is working?

sensory wrote:
Mr.Elendig wrote:

Do not do this, never export TERM ever.

Why shouldn't I export TERM? I've always been told the opposite.

Thanks for all the replies; I'll check out all your suggestions when I'm at my computer. smile

You for some reason run a different terminal but don't change the TERM export.  Enjoy your broken apps / messed up terminal.
Generally a good idea to let the terminal itself say what it is...

Last edited by Mr.Elendig (2011-07-22 16:59:27)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#11 2011-07-22 17:11:38

sensory
Member
From: UK
Registered: 2010-05-01
Posts: 40

Re: How can I make sure that export TERM=rxvt-unicode is working?

Mr.Elendig wrote:

You for some reason run a different terminal but don't change the TERM export.  Enjoy your broken apps / messed up terminal.
Generally a good idea to let the terminal itself say what it is...

That's not really an answer..

Offline

#12 2011-07-22 17:49:16

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: How can I make sure that export TERM=rxvt-unicode is working?

How is that not an answer? Libraries such as ncurses depend on the term name to figure out terminal capabilities (man terminfo) and the proper escape sequences to send. If you change this, you change the way applications behave.

TERM=dumb <insert ncurses app>

Offline

#13 2011-07-22 17:59:51

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How can I make sure that export TERM=rxvt-unicode is working?

sensory wrote:
Mr.Elendig wrote:

You for some reason run a different terminal but don't change the TERM export.  Enjoy your broken apps / messed up terminal.
Generally a good idea to let the terminal itself say what it is...

That's not really an answer..

Well, it is, but I'll try to answer in a somewhat different way.

Different terminals(the "device") provide different interfaces/capabilities to applications. So sometimes some applications need to know which terminal they're running on. They may rely on the TERM environment variable to determine this. This is why terminals should always set the correct TERM environment. (The terminfo(5) man page should be of great help on this topic.) This is also why setting and exporting the TERM environment in your shell startup script (e.g., ~/.bashrc) is a bad idea, since it will always override the (supposedly correct) TERM environment set by the terminal itself and blindly set the TERM variable to an arbitrary value -- it's like labeling all toilets around the world as "women" wink

No, let the toilet say what sex it is. Men need somewhere to pee.


This silver ladybug at line 28...

Offline

#14 2011-07-22 18:50:46

sensory
Member
From: UK
Registered: 2010-05-01
Posts: 40

Re: How can I make sure that export TERM=rxvt-unicode is working?

falconindy wrote:

How is that not an answer? Libraries such as ncurses depend on the term name to figure out terminal capabilities (man terminfo) and the proper escape sequences to send. If you change this, you change the way applications behave.

TERM=dumb <insert ncurses app>

Because the reply wasn't informative. You can tell someone not to do something but if you don't inform them why it's bad to do so, you're not helping. Your reply on the other hand was informative and helpful, so thank you for that.

lolilolicon wrote:

Well, it is, but I'll try to answer in a somewhat different way.

Many thanks for taking the time to explain all that. I really appreciate the information. smile

Offline

Board footer

Powered by FluxBB