标题:shell脚本中source问题
取消只看楼主
suxiaochen
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-3-3
 问题点数:0 回复次数:0 
shell脚本中source问题
shell脚本(test.sh)如下:

#!/bin/sh

echo "export monitor=1" >> /etc/profile
source /etc/profile

调用后(./test.sh),执行echo $monitor,没有输出任何值

手动source /etc/profile后,再次执行echo $monitor,输出了预期的值

可见脚本中的source /etc/profile没有成功,请问这个应该怎么解决?
搜索更多相关主题的帖子: shell source 脚本 
2010-04-26 19:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-304484-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019398 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved