linux cross-distro environment variable modification via script?
What is the best way to modify or create environment variables from a script in a 开发者_运维百科way that is cross distro/*nix friendly? I simply want to add a couple of environment variables via a bootstrap script, but there are so many places to do this and, for example, ubuntu prefers /etc/environment but I don't want to write a lot of logic to deal with different distros and I would like to support OS X. Is there a best-practices way to do this?
For the Mac OS X bit, this question appears to have discussed it to good depth. And, this question appears to have a decent discussion for global environment variables on Linux.
I see a /etc/environment but it is empty, on Debian system. I think global initialization files are defined per shell, if a shell has such a file.
精彩评论