1829737 Members
1639 Online
109992 Solutions
New Discussion

$PATH problem

 
SOLVED
Go to solution
Declan Heerey
Frequent Advisor

$PATH problem

I am trying to add a environment variable to a users $PATH but when I add the variable, set and export the $PATH the variable is lost when I log out. Preferably I don't want to explicitly set the variable in the user .profile is there a way of setting the variable permanently? A previous administrator has done it but I can't work out how.
8 REPLIES 8
Leif Halvarsson_2
Honored Contributor

Re: $PATH problem

Hi,
Are you running CDE ? If so you must set the variable in .dtprofile or uncomment the line DTSOURCEPROFILE=true in the same file (.dtprofile).
Domenico_5
Respected Contributor

Re: $PATH problem

in /etc/profile

regards
James R. Ferguson
Acclaimed Contributor

Re: $PATH problem

Hi:

Well, a global PATH variable is declared in '/etc/PATH' which is sourced (read) by '/etc/profile' when it is read during login.

Obviously, if you choose to add to the global PATH, *every* user gains the new directory as a part of their PATH which may not be desirable.

Regards!

...JRF...
John Poff
Honored Contributor
Solution

Re: $PATH problem

Hi,

If you want to add a directory to the PATH variable so that everybody who logs into the system will get it, you can put it into the /etc/PATH file.

Otherwise, you'll either have to add it to the user's .profile or put it in a separate file and source it into their profile.

JP
H.Merijn Brand (procura
Honored Contributor

Re: $PATH problem

(t)csh users source /etc/csh.login instead of /etc/profile
It also reads (sources) /etc/PATH, so that is your way to go

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Declan Heerey
Frequent Advisor

Re: $PATH problem

The .profile is sourcing the additional environment variables set up in another environment file. I have added my PATH to this and used the setpath command and it has worked - Thanks one and all for the speedy replies. And of course i will assign points as a show of my gratitude
Patrick Wallek
Honored Contributor

Re: $PATH problem

There is no way to keep the $PATH variable set without adding it to either /etc/PATH, /etc/profile or the users .profile file.

When you set a variable while you are logged in, it is for that session only. As you have seen, it goes away when you log out. That is why .profile, .cshrc, .login, etc. exist.
Mehdi_1
Regular Advisor

Re: $PATH problem

Hi

Has the previous administrator used "setup" to set the path?

Mehdi