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

1 例如

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

  

 

2 解决办法

加上 source /etc/profile 就好了

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

  

3 原因

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

 

posted @ 2019-07-12 22:43  Questions张  阅读(8356)  评论(0编辑  收藏  举报