LinuxQuestions.org
Help answer threads with 0 replies.
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 09-19-2002, 12:16 PM   #1
Ethan
Member
 
Registered: Mar 2002
Location: California, USA
Posts: 41

Rep: Reputation: 15
WHERE should you set PATH?


I've heard a lot about environment variables, but I'm still not sure what config file should contain the setting for PATH.

/etc/rc.d/rc.local ?
/etc/profile ?
/etc/bashrc ?

Related question:

If you use " export " when setting an environment variable, that means that any application or shell on the system can access the variable, right? So why is it that I when I put

export SOMEVAR="somevalue";

in /etc/profile, then restart and then try

echo $SOMEVAR

it returns nothing?

Thanks in advance for any information on these pressing issues!

Ethan
 
Old 09-19-2002, 09:50 PM   #2
jetblackz
Member
 
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711

Rep: Reputation: 30
/etc/profile
 
Old 09-20-2002, 12:07 PM   #3
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
exporting a variable isn't meant to make it survive a reboot (I assume you mean that you rebooted the system when you say "restart"). The function of export is, for instance, if you opened two xterms side by side and set a variable in one, you couldn't echo it in the other until you'd exported it in the first. Hope that helps.
 
Old 09-20-2002, 12:35 PM   #4
jpweston
Member
 
Registered: Mar 2002
Location: Sacramento, CA
Distribution: Slackware 8.1; Debian 3.0
Posts: 222

Rep: Reputation: 30
For setting the PATH, if you want the PATH to apply to all users, set it in /etc/profile. If you just want the PATH to apply to a single user, set it in the user's .bash_profile

If your "export" example is what you entered in /etc/profile, try not using the double quotes around the value and not adding a semi-colon to the end. I just entered the following line to my /etc/profile:

export TOOBY=jones

When I logged out and logged back in, the echo $TOOBY command returned jones.

If you were to do the export from the command line, then the value would disappear when you logged out or rebooted. Since you're putting it in /etc/profile, it should be permanent since /etc/profile is read whenever anyone logs in.

HTH

j.

Last edited by jpweston; 09-20-2002 at 12:36 PM.
 
  


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
how to set my so path? hongxing Linux - Software 1 10-20-2005 02:23 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 12:24 AM
9.1 set $PATH seingoku Slackware 6 02-06-2004 03:12 PM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM
$PATH!? how to set these PATH(s)!? sirpelidor Red Hat 5 10-25-2003 04:00 PM

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

All times are GMT -5. The time now is 01:58 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