原文:https://blog.csdn.net/yule09/article/details/86537652

 

本机shell命令可以执行,jenkins任务中无法执行,则是jenkins没有加载/etc/profile导致,

需要在jenkins调用shell脚本的最前面加一行脚本,

#!/bin/bash -ilex

可以通过-i参数和-l参数让bash为login shell and interactive shell,

就可以读取/etc/profile和~/.bash_profile等文件

 

#!/bin/bash -ilex

ifconfig

 

------以下这部分我暂时没有用到-------

ssh命令中可以直接添加 source /etc/profile

ssh xxx@xxxx 'source /etc/profile; ifconfig'

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-12-21
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2021-06-17
  • 2021-12-18
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2021-09-10
相关资源
相似解决方案