export 在shell脚本中设置环境变量失效
2013-01-06 11:49
1546 查看
今天上午在shell脚本中用export设置系统环境变量。结果运行几次都没设置成功。是使用./filename运行脚本的。
后来网上一查。 my god。 原来是shell脚本中设定的路径和环境变量只对改shell和其子shell有效。 对其父shell和其它shell无效。
![](http://blog.csdn.net/nemo2011/article/details/file:/C:\Documents and Settings\Administrator\Application Data\Tencent\Users\280741276\QQ\WinTemp\RichOle\6))]C2H7V$(ND%`5$}8F742.jpg)
解决方法:
source filename.sh
就OK了。source 使shell脚本里的设置对其它shell也有效。
后来网上一查。 my god。 原来是shell脚本中设定的路径和环境变量只对改shell和其子shell有效。 对其父shell和其它shell无效。
![](http://blog.csdn.net/nemo2011/article/details/file:/C:\Documents and Settings\Administrator\Application Data\Tencent\Users\280741276\QQ\WinTemp\RichOle\6))]C2H7V$(ND%`5$}8F742.jpg)
解决方法:
source filename.sh
就OK了。source 使shell脚本里的设置对其它shell也有效。
相关文章推荐
- 通过shell脚本设置qnx系统的环境变量
- php 执行 shell 脚本环境变量设置
- shell脚本设置登陆环境变量
- shell脚本设置环境变量不生效
- solaris设置环境变量shell脚本
- linux中shell脚本设置环境变量
- 在Linux里设置环境变量的方法(export PATH)
- Shell(bash)脚本学习之--------内建/外建,自定义变量和环境变量
- 设置系统环境变量立即生效的VBS脚本
- Linux下env、export、echo和set命令的用法与区别(Linux环境变量的设置)
- Linux下环境变量的设置-export命令
- 在Linux里设置环境变量的方法(export PATH)
- 在Linux里设置环境变量的方法(export PATH)
- shell脚本配置环境变量时 source XXX.sh与 ./XXX.sh的区别
- 设置环境变量永久生效和临时生效 export PS1
- 在Linux里设置环境变量的方法(export PATH)
- 在Linux里设置环境变量的方法(export PATH)
- Linux里设置环境变量的方法(export PATH)
- 自动设置JAVA环境变量的脚本转自(JAVA中文世界---紫叶)
- 在Linux里设置环境变量的方法(export PATH)