Jenkins 执行 build.sh 报错 build.sh: : not found
13:57:58 Started by user admin13:57:58 Building in workspace /var/jenkins_home/workspace/spring-cloud-registry13:57:58 [spring-cloud-registry] $ /bin/bash /tmp/jenkins6320373055639002513.sh13:57:5...
·
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 替换成空白
更多推荐
已为社区贡献12条内容
所有评论(0)