I'm upgrading to maven 3 but have hit a small snag in that maven 2 is mysteriously showing up in my PATH variable. I've checked ~/.bashrc, ~/.profile, /etc/bash.bashrc, /etc/environment, /etc/profile and can't find it anywhere. What am I missing?
1 Answers
From man bash:
When bash is invoked as an interactive login shell, or as a non-inter‐ active shell with the --login option, it first reads and executes com‐ mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.
As you have logged into an interactive non-login shell, the files to look for the PATH assignment is /etc/bash.bashrc, ~/.bashrc and also in /etc/environment as its the default place to declare system wide environment variables. You should also check the directories that are sourced while logging into an interactive login shell to be sure that there is no reference or pointer to change PATH in them.
If you does not find any reference to PATH having maven-2 then there must be something in one of these files that is causing the PATH to be changed i.e. something in one of these files triggering something else that is changing the PATH. It is very hard to tell without checking the content of the files.
If you want to remove maven-2 from your PATH:
/home/elpinguino/scala-2.10.5/bin:/home/elpinguino/bin:/usr/local/sbin
:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
:/opt/apache-maven-2.2.1/bin:/bin:/bin:/opt/apache-maven-3.3.3/bin
You can either remove the directory /opt/apache-maven-2.2.1 so that PATH won't find the executable or declare PATH environment variable again discarding the /opt/apache-maven-2.2.1/bin directory and putting it at the end of ~/.bashrc.
- 91,753
echo "$PATH"? how did you find it in your path? – heemayl May 07 '15 at 23:50sudo rm -r /opt/apache-maven-2.2.1or 2)remove/opt/apache-maven-2.2.1/binfromPATH. Which one do you want? – heemayl May 07 '15 at 23:54PATH? – heemayl May 07 '15 at 23:59~/.bash_profileor~/.bash_login. If so , check them – heemayl May 08 '15 at 00:02