linux交叉发行版环境变量修改通过脚本? [英] linux cross-distro environment variable modification via script?

查看:198
本文介绍了linux交叉发行版环境变量修改通过脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从脚本中修改或创建环境变量的最佳方法是以交叉发行/ * nix友好的方式?我只想通过引导脚本添加几个环境变量,但是有很多地方可以做到这一点,例如ubuntu更喜欢/ etc / environment,但是我不想写很多逻辑来处理不同的发行版,我想支持OS X.有没有最佳的做法呢?

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?

推荐答案

对于Mac OS X位,这个问题似乎已经深入讨论了。而且,此问题似乎在Linux上对全球环境变量进行了一个体面的讨论。

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.

我在Debian系统上看到一个/ etc / environment,但是是空的。我认为全局初始化文件是根据shell定义的,如果shell有这样一个文件。

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.

这篇关于linux交叉发行版环境变量修改通过脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆