Search code examples
command-linepathosx-lionenv

env command shows 3 times same path


When i run env it shows 3 times /usr/bin under PATH . Same for every path under PATH title.
For example - my scala bin directory shows 3 times .

However, in my .bash_profile, it is written just one time . Also its not in .bashrc also. I need to make this 3 occurrences to 1, as even though I remove some path under PATH in .bash_profile, it still shows 2 times , which means that path is still set.

echo $PATH shows the same thing.
And , if it matters I am using macosx.


Solution

  • OK..So I found the solution.
    Here is what I was doing :-
    1) vi ~/.bash_profile
    2) make changes
    3) source ~/.bash_profile to see those changes in effect .

    It seems for every editing and subsequent source command, temporarily keeps in current session.
    So , if i made changes 3 times and consequent source command, it shows 3 times the same path if i do echo $PATH or env. Closing the terminal and restarting it puts back everything to normal.

    So, it was just a matter or restarting the terminal!!

    Clarification :- Different platforms may perform differently. I found macosx-10.7 works this way.