首页 > 系统服务 > 详细

jenkins执行shell命令,有时会提示“Command not found”----解决方案

时间:2019-07-11 14:56:56      阅读:111      评论:0      收藏:0      [点我收藏+]

jenkins执行shell命令,有时会提示“Command not found”----处理方案

1、如果登录linux,shell命令不可以执行,同样提示“Command not found”,则是环境变量设置失败,需要配置环境变量:/etc/profile

2、如果登录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 found”----解决方案

原文:https://www.cnblogs.com/orzs/p/11168802.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!