LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-15-2007, 10:11 PM   #1
xeon123
Member
 
Registered: Sep 2006
Posts: 374

Rep: Reputation: 16
Environment variables


Hi,

I'm having some troubles to understand the env command.

I know that env is to set environment variables.

1 - The variables are declared in any special file?

2 - If I've a .bashrc or a .bash_profile in my user directory, the content of this values (eg. JAVA_HOME=/opt/jdk1.6.0_01; PATH=$PATH:$JAVA_HOME/bin; export PATH) will prevail over the environment variables defined?

3 - What's the difference between .bashrc and .bash_profile?

4 - In my bash_profile I've the following:

Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
JAVA_HOME=/opt/jdk1.6.0_01
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

export PATH
unset USERNAME
What's reason of the export command? What means the "unset USERNAME" line?


Thanks,
Pedro
 
Old 05-16-2007, 06:21 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
from env(1)

env - run a program in a modified environment
[snip] Set each NAME to VALUE in the environment and run COMMAND.

... it allows you to modify the environment for a particular program/command only. To set or change an environment variable, for all subsequent programs, you use the export command:

from export(1)

export sets the export attribute on each of the variables specified by name which causes them to be in the environment of subsequently executed commands. If =value is specified, the variable name is set to value.

from unset(1)

unset - unset values and attributes of variables and functions

... in this case it appears to remove USERNAME from the environment
 
Old 05-16-2007, 06:27 AM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
from bash(1)
[snip]
the system wide initialization file /etc/bash.bashrc and the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
[snip]
the system-wide startup file /etc/profile or any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile. By default, bash reads these files when it is invoked as a login shell (see INVOCATION below)

... which should answer the questions about bashrc and bash_profile, especially if you go read the bit about invocation in the manpage.

Last edited by Simon Bridge; 05-16-2007 at 06:30 AM.
 
Old 05-16-2007, 09:48 AM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Off-topic, sorry: Simon, how did you get monospace w/o using a "Code" block? Specifically what OS/browser combo. are you using? I can't get LQ "Fonts" to function in MEPIS/Konq. 3.3.2.

Tried in MEPIS 6.0/Konq. 3.5.3 -- even worse. WTFO, there I'm using as up to date a browser/OS as can reasonably be expected & it still doesn't work.

Last edited by archtoad6; 05-16-2007 at 10:59 AM.
 
Old 05-16-2007, 12:59 PM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
If you click the "quote" button, you'll see I used a font block. (I just typed the bv code in.)

I'm using firefox 2.0.0.3 in feisty ... and I can't actually see the courier font right now myself, so I'm glad to know it's working.
 
Old 05-17-2007, 07:37 PM   #6
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
I did click the "quote" button, that's why I asked the Q . The problem is, when I click the "Fonts" drop down the selector doesn't work. I can type the entire tag set & it works.

This (Advanced) edit done in Opera 9.01
Some font tests:
  • Century Gothic?
  • Arial Black?
  • Franklin Gothic Medium?
  • Times New Roman?
  • System?

  • monospace = Arial
  • monospace = Arial Narrow
  • monospace = Courier New
  • monospace = courier (entered manually)
In "Preview Changes" (in Opera 9.01) all of the above, particularly Arial & Arial Narrow, look the same except that "Times New Roman" is serifed & "Courier New" & "courier" seem to be monospaced, at least they are narrower than the others.

Note: If you don't understand my examples, or what I'm trying to show, Simon says 'click the "quote" button'. (Couldn't resist that one, although I'm sure Simon is tired of it. )

This (Advanced) edit done in Konq. 3.3.2
Only plain "courier" looks different, all of the rest look the same, i.e. do not display as intended, in this browser.

This (Advanced) edit done in <spew>M$IE 6</spew>
As you can see, I am committing heresy for the sake of knowledge.
All the fonts are displayed correctly above, as well as in the dropdown; & of course the dropdown works.
WTFO, a premier Linux site that that works best w/ the browser the experienced membership should be least likely to use? Apologies for the emotional outburst, but I am, to say the least, taken aback. (Well, at least Spell Check doesn't work as well in M$IE as in Konq. & Opera.)

Last edited by archtoad6; 05-19-2007 at 07:44 AM. Reason: add browser specific notes & examples
 
Old 05-18-2007, 07:57 PM   #7
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Yup - the toolbar has never worked for me neither.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting all environment variables Harlin Linux - General 2 10-06-2006 12:30 PM
environment variables in c++ s3b0 Programming 6 08-27-2004 09:19 AM
environment variables kakridge Linux - Newbie 1 07-14-2003 06:25 PM
environment variables. jISV Linux - General 0 04-05-2002 06:01 AM
environment variables da Perp Linux - Newbie 5 01-23-2002 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:16 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration