| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1138 人关注过本帖
标题: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
快速回复:shell脚本中source问题
数据加载中...
 
   



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

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