在这里插入图片描述

13:57:58 Started by user admin
13:57:58 Building in workspace /var/jenkins_home/workspace/spring-cloud-registry
13:57:58 [spring-cloud-registry] $ /bin/bash /tmp/jenkins6320373055639002513.sh
13:57:58 build.sh: 2: build.sh: 
: not found
13:57:58 build.sh: 7: build.sh: 
: not found
13:57:58 build.sh: 10: build.sh: 
: not found
13:57:58 build.sh: 35: build.sh: Syntax error: end of file unexpected (expecting "then")
13:57:58 Build step 'Execute shell' marked build as failure
13:57:58 Finished: FAILURE

解决方案

#!/bin/bash

sed -i 's/\r$//' build.sh

sh build.sh

会把 build.sh 中的\r 替换成空白

参考博客:解决报错 “build.sh /bin/bash^M: 坏的解释器:没有那个文件或目录”

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐