Quote:
Originally posted by nicolet@Aug 13 2004, 20:11
The more I mess around with installs the more I keep running into this.* I'm looking for a 'best practice' suggestion.
|
First, I am unsure why you are so worried about this problem. Is there anything beyond aesthetic reasons? There simply is no harm I can think of because you have some directories repeated twice in your $PATH variable. If there is something, I would like to be enlightened as well
Ok, now to really answer your question (this method may not work on other distributions) -- the reason this happens is because your '/etc/profile' is run twice. I am not sure when these things happen exactly, but I can say for certain from what you see that it is run twice. What can you do? Well, suse exports an environment variable called 'PROFILEREAD' which is set to 'true' when the profile is read once. So, you can test for its value and only set your PATH if this variable is not set already. Something like
Code:
if test -z "$PROFILEREAD"; then
PATH="$PATH":/usr/local/nessus/bin:/usr/local/nessus/sbin
export PATH
fi
A better practice, I would say, is to create your own variable (say, LOCALPROFILEREAD or something) and set it to true at the end of your /etc/profile.local. That way, you can test for this variable, and not depend on suse exporting a variable named 'PROFILEREAD' in future releases. Of course, such a method will work in other distributions too.