美文网首页
jenkins执行shell命令,提示“Command not

jenkins执行shell命令,提示“Command not

作者: 垃圾桶边的狗 | 来源:发表于2022-06-04 22:01 被阅读0次

如果登录linux,shell命令可以执行,则是jenkins没有加载/etc/profile导致,需要在jenkins调用shell脚本的最前面加一行脚本,#!/bin/bash -ilex,可以通过-i参数和-l参数让bash为login shell and interactive shell,就可以读取/etc/profile和~/.bash_profile等文件,如下“

#!/bin/bash -ilex
cd..

等其他shell命令

对于e参数表示一旦出错,就退出当前的shell,x参数表示可以显示所执行的每一条命令

引自

相关文章

网友评论

      本文标题:jenkins执行shell命令,提示“Command not

      本文链接:https://www.haomeiwen.com/subject/haelmrtx.html