bash Jenkins 因执行 shell 脚本而失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41666314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:37:25  来源:igfitidea点击:

Jenkins fails with Execute shell script

bashshelljenkins

提问by To Kra

I have my bash script in ${JENKINS_HOME}/scripts/convertSubt.sh

我有我的 bash 脚本 ${JENKINS_HOME}/scripts/convertSubt.sh

My job has build step Execute shell: enter image description here

我的工作有构建步骤执行 shell在此处输入图片说明

However after I run job it fails: enter image description here

但是,在我运行作业后,它失败了: 在此处输入图片说明

回答by user1934428

The error message (i.e. the 0:part) suggests, that there is an error while executing the script.

错误消息(即0:部分)表明,执行脚本时出现错误。

You could run the script with

你可以运行脚本

sh -x convertSubt.sh

For the safe side, you could also do a

为了安全起见,你也可以做一个

ls -l convertSubt.sh
file convertSubt.sh

before you run it.

在你运行它之前。

回答by Mor Lajb

  1. make sure that the script exist with ls
  2. no need to sh , just ./convertSubs.sh ( make sure you have run permissions)
  1. 确保脚本与ls 一起存在
  2. 不需要 sh ,只需要 ./convertSubs.sh (确保你有运行权限)