phunni Posted March 7, 2003 Report Share Posted March 7, 2003 How do I set system wide environment variables? I currently have some stuff in my .bashrc - classpath, path and others, but I want to know how to set soemthing up at a more fundamental level than that. For example, I can only run Java applications either by specifying the location of my Java install in the apps config, or by running it in a shell that has access to what I set in .bashrc If I want to run a Java app from an icon or similar - it doesn't look at .bashrc and therefore never finds the java command. I hope this makes sense :D Quote Link to comment Share on other sites More sharing options...
theYinYeti Posted March 7, 2003 Report Share Posted March 7, 2003 Basically, put every global setting to /etc/profile You can also be more organized and create many little scripts, each related to its own topic, executable inside /etc/profile.d/ ; that way, you can even backup those scripts, and put them there again after you update your Mandrake (if you do). There are other possibilities. For example, for me, all Java-related stuff is inside /etc/java/java.conf file. Inside /etc/profile, I have this line: . /etc/java/java.conf Yves. Quote Link to comment Share on other sites More sharing options...
phunni Posted March 7, 2003 Author Report Share Posted March 7, 2003 great, thanks Quote Link to comment Share on other sites More sharing options...
phunni Posted March 7, 2003 Author Report Share Posted March 7, 2003 bit confused - where does profile.d fit in? The example you gave didn't include it, but you mention it Quote Link to comment Share on other sites More sharing options...
aru Posted March 8, 2003 Report Share Posted March 8, 2003 bit confused - where does profile.d fit in? The example you gave didn't include it, but you mention it The file to put the global settings is /etc/profile but as putting all the settings in a single file can be a mess, you can source other config files, and here is where the /etc/profile.d/ dir plays a role. Check your /etc/profile file and you'll see something like this: for i in /etc/profile.d/*.sh; do if [ -x $i ]; then . $i fi done that means to 'source' every 'file.sh' located /etc/profile.d/ so you can create configuration scripts, such as "javaconf.sh", and include them in /etc/profile.d/ Quote Link to comment Share on other sites More sharing options...
Cannonfodder Posted March 8, 2003 Report Share Posted March 8, 2003 Just to explain it further, any scripts found in the folder /etc/profile.d are automatically executed when you login. For example, I have a bunch of alias commands and other scripts stored in a file located in profile.d. I don't have to tell the OS to run that script. I just have to put the file into the profile.d folder. This is also useful for when you open a console (terminal). It in turn will execute the scripts in the profile.d folder each time.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.