LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (http://www.linuxquestions.org/questions/fedora-35/)
-   -   How to set up an system wide environment variable permanently?? (http://www.linuxquestions.org/questions/fedora-35/how-to-set-up-an-system-wide-environment-variable-permanently-603858/)

piyush.kansal 12-02-2007 12:46 AM

How to set up an system wide environment variable permanently??
 
Hi,
Objective:
Its to set up a system wide environment variable permanently, I want to set CVSROOT to /usr/local/CVS. Also, I want to get it set immediately i.e i dont want to reboot my machine..

Distribution?
Fedora Core 1

Problem:
I am unable to do so :(

What has been tried?
I put following in the last line of /etc/profile file (as a root):
CVSROOT="/usr/local/CVS"
and then I tried to get it set immediately by running following:
[root@localhost piyushkansal]# . /etc/profile
After this when I echo'ed the same, it worked:
[root@localhost piyushkansal]# echo $CVSROOT
/usr/local/CVS
But when i tried to do get code (from local login, not root) from CVS it gave me an error. You can see the following sequence of commands i fired from my local login but it didnt work:
[piyushkansal@localhost HelloWorld]$ cvs co -d 2 KernelDevelopment
cvs checkout: No CVSROOT specified! Please use the `-d' option
cvs [checkout aborted]: or set the CVSROOT environment variable.
[piyushkansal@localhost HelloWorld]$ echo $CVSROOT

[piyushkansal@localhost HelloWorld]$ . /etc/profile
[piyushkansal@localhost HelloWorld]$ echo $CVSROOT
/usr/local/CVS
[piyushkansal@localhost HelloWorld]$ cvs co -d 2 KernelDevelopment
cvs checkout: No CVSROOT specified! Please use the `-d' option
cvs [checkout aborted]: or set the CVSROOT environment variable.
[piyushkansal@localhost HelloWorld]$

I even tried to reboot my system and it didnt work even after that. I also tried to set CVSROOT to /usr/local/CVS/ but it didnt work too...

Please suggest me if I am missing something....

whansard 12-02-2007 12:58 AM

Is the directory writable by all the users?

piyush.kansal 12-02-2007 01:14 AM

Hi,
Besides root, I have got only one more user configured and that is "piyushkansal"...and this user has already got the rights:

[root@localhost 2]# ll /usr/local/ | grep CVS
drwxrwsr-x 5 root piyushkansal 4096 Dec 1 12:32 CVS
[root@localhost 2]#

Here for "others", its not writable, but will it make a difference?

whansard 12-02-2007 01:44 PM

Are you using the export command to make the variable available?

piyush.kansal 12-04-2007 11:50 PM

Not in /etc/profile.
But yes, I am using it so that initialize CVSROOT with the same value, but that it session dependent. As soon as i close the session, it goes away, so its temporary.

piyush.kansal 12-07-2007 04:04 AM

Any suggestions, please?


All times are GMT -5. The time now is 07:18 AM.