shell脚本中使用nohup执行命令不生效

时间:2019-07-12 23:36:42   收藏:0   阅读:1607

1 例如

!#/bin/bash
nohup echo "hello world"

  

 

2 解决办法

加上 source /etc/profile 就好了

!#/bin/bash
source /etc/profile
nohup echo "hello world"

  

3 原因

  找不到环境变量,所以先source一下

 

原文:https://www.cnblogs.com/QuestionsZhang/p/11178825.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!