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没有成功,请问这个应该怎么解决?
2010-04-26 19:46
2010-05-16 00:31
2010-11-16 09:05
2011-01-19 20:46
2011-03-08 23:48