#2
vfdff2010-05-16 00:31
|
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没有成功,请问这个应该怎么解决?