Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When would the order of $PATH vary?


When someone's changed it? Which people do _all the time_.


Mine is changed for Heroku, but it only prepends. I've never seen $PATH be rearranged.


If you prefix it with something already in there then it's effectively rearranged.

You wouldn't do this deliberately, of course, but it happens a lot - people end up with massive PATHs because they blindly prefix when something's gone wrong and it _may_ be the solution.


I was thinking prepending and appending aren't rearranging.


The important part of my above sentence was "with something already there".

If $PATH == 'a:b' and you do `export PATH=b:$PATH, then you've basically rearranged it. It may as well be 'b:a'.


To give a concrete example, OS X 10.9 (Mavericks) has `/usr/bin` listed before `/usr/local/bin` in `/etc/paths`. This was flipped in 10.10 and up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: