9 ms·
always felt like the Windows mechanism of having at least one non-ambiguously global place to set environment variables to be super useful to deal with (instead
by rtpg 11y ago
always felt like the Windows mechanism of having at least one non-ambiguously global place to set environment variables to be super useful to deal with (instead of the ubuntu '/etc/environment/', except when it's '.profile', except when it's '.pam_environment', except when its '.bashrc')
- whoopdedo 11y agoBaseless argument. Windows also splits the environment between the HKLM and HKCU hives. It just gives you a handy window to edit both at once. .profile is a login script, not the recommended place for setting variables although historically it has been because /etc/environment and ~/.pam_environment are relatively recent additions to Linux. (Why didn't distros adopt the ~/.env though that other Unixes, like AIX, use?) But there Windows also has the profile login script and I don't know if it's possible to export environment variables from it but that serves the same purpose of ~/.profile. So all those things you say are bad about Linux exist on Windows.
- gpvos 11y agoI never heard of /etc/environment and ~/.pam_environment before, and thought /etc/profile was the place for variables for all users, with only .profile and .bashrc to check for user variables. Looks like Linux is going the Windows way by providing too many places to configure things.
- rtpg 11y agoI'm not against there being many different hooks in your average linux distro, but googling 'how to set environment variables in Ubuntu' gives you 20 different answers, with many conflicting statements between them.
- telotortium 11y agoHaving worked with AIX fairly recently, I was under the impression that ~/.env was merely a common value for the ENV environment variable, which is a shell script that plays the same role for Korn shell (and possibly POSIX sh) as ~/.bashrc does for Bash. This page seems to support that interpretation: http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.osdevice/env_file.htm%23env_file?lang=en http://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.... On the other hand, I think /etc/environment on Linux (not sure about AIX) and ~/.pam_environment are not shell scripts.
- yokohummer7 11y agoWhat's worse, Linux (or Unix) requires the user to re-login to make the changed environment variables take effect. Whereas in Windows they are applied immediately, so you don't have to re-login after changing PATH.
- hikarudo 11y agosource ~/.bashrc
- anon4 11y agoAnd this will change it for programs I launch by clicking on the launcher menu?
- cosarara97 11y agoYou could have the launcher source your .profile/.env/whatever on every app launch. Count it as a bug in your launcher ;)
- Dylan16807 11y agoActually Explorer manually reloads environment variables when you change them, and nothing else is affected.
- yokohummer7 11y agoThat's a neat trick, thanks for pointing me out. I've always wondered how Windows could have accomplished that. It's a shame that Linux doesn't have such an equivalent. If we are to do the same thing in Linux, a login shell (bash or zsh or even GNOME) would be the right place to implement?
- MatmaRex 11y agoThere's a recent post from Raymond Chen about this, actually: http://blogs.msdn.com/b/oldnewthing/archive/2015/09/15/10641604.aspx http://blogs.msdn.com/b/oldnewthing/archive/2015/09/15/10641...