I'm very new to Ubuntu so please bare with me. I'm trying to install Euler expert system following those instructions
to add the environment variable I edited my /etc/environment to become as follows:

 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/home/mohammad/Desktop/eye"
 EYE_HOME = "/home/mohammad/Desktop/eye"

but when I use printenv PATH I don't see the new directory added to my path.

what am I doing wrong here ?

share|improve this question
    
That link isn't working right now (SourceForge is down) but can you specify whether you want system-wide environment variables? Since it's for an application, this is likely the case, and therefore a lot of the answers below are wrong. – Michael Scheper Jul 22 '15 at 17:51
up vote 6 down vote accepted

I don't know the reason why PATH wasn't changed (after relogin), but

EYE_HOME = "/home/mohammad/Desktop/eye"
--------^-^

those spaces prevent EYE_HOME to be set.

It should be noted that /etc/environment is not a script file, but a kind of assignment file that is read by PAM. OTOH such spaces are not allowed in script files like /etc/profile and ~/.profile either.

If you use a script file, you need to export the variables as shown in Avinash Raj's answer.

Please note that while ~/.bashrc works if you start your program from a terminal window, it may not work if you start it from the graphical environment, since it's not sourced by the display manager.

share|improve this answer
    
@gunnar-hijalmarsson --- correct. The fact that the display manager is not started from my shell bite me much times. I have posted a trick to see the variables that are set in the DE: askubuntu.com/a/356973/16395 – Rmano Dec 16 '13 at 18:16
    
Nice trick, @Rmano! Any chance that you can add it to help.ubuntu.com/community/EnvironmentVariables ? – Gunnar Hjalmarsson Dec 17 '13 at 7:06
    
Thanks - I never edited one of that and I do not know if I had the permissions. I will look into it if I have time, but otherwise feel free to copy/paste whatever you want --- that page needs badly to be put up-to-date. One question: do all the display managers (lightdm, gdm, kdm) source ~/.profile even if my default shell is not bash but, for example, zsh? – Rmano Dec 17 '13 at 15:13
    
Checked by myself. I use zsh; the applications launched by the DE see variables set in ~/.pam_environment and ~/.profile (NOT ~/.zprofile). This is good and bad, but the bad part is solved by changing .profile so that it sources my .zprofile and .zshenv. And I confirm that using .pam_environment is bad, it is overwritten sometime (shouldn't, but it is). – Rmano Dec 17 '13 at 15:27
    
@Rmano: I know that ~/.profile is sourced by lightdm and gdm; not sure about kdm. – Gunnar Hjalmarsson Dec 17 '13 at 20:28
gedit ~/.bashrc

After that add the below lines,

export EYE_HOME="/home/mohammad/Desktop/eye"
export PATH=$PATH:$EYE_HOME

Save the file and sourec it,

source ~/.bashrc
share|improve this answer
1  
would that be a system wide variable ? – Mhd.Tahawi Dec 16 '13 at 11:48
    
    
@AvinashRaj: this variables not only will be user-only, but they will not be seen if the application is not started from a command-line terminal... the graphical environment is started by itself, not using the user's shell. See askubuntu.com/a/356973/16395 – Rmano Dec 16 '13 at 18:12

You want to edit your .bashrc file in your home directory.

When you edit the path you should include :$PATH on the end so you don't replace the current path.

share|improve this answer

You can try these two files too for system wide configuration:

  • /etc/profile
  • /etc/bashrc

For user wide configuration:

  • $HOME/.profile
  • $HOME/.bashrc

Just append the variables as you have done on /etc/environment. But you will have to login and logout (or run the proper reload). Maybe by login and logout /etc/environment would work but I am not sure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.