-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory

文章目录

场景

jenkins 发布失败, 报错ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]], 这说明远程服务器的deploy.sh执行失败, 首先检查权限,没有发现问题,然后手动执行一遍又报错"-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory", 这个意味着脚本是windows回车符结尾

txt 复制代码
[JENKINS] Archiving /home/vagrant/.jenkins/workspace/jenkinsDemo/target/jenkinsDemo-1.0-SNAPSHOT.jar to com.carsonlius/jenkinsDemo/1.0-SNAPSHOT/jenkinsDemo-1.0-SNAPSHOT.jar
channel stopped
SSH: Connecting from host [ubuntu-xenial]
SSH: Connecting with configuration [107.173.111.224 自己] ...
SSH: EXEC: completed after 604 ms
SSH: Disconnecting configuration [107.173.111.224 自己] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE

解决

sed -i -e 's/\r$//' deploy.sh

相关推荐
超级大福宝5 小时前
PowerShell 实现类似 Bash 的补全行为
bash·powershell
一点事1 天前
windows:ELK搭建(单机)
windows·elk·jenkins
lcx_defender1 天前
【Docker】Docker部署运行Elasticsearch
elasticsearch·docker·jenkins
dingdingfish2 天前
GNU Parallel 学习 - 第1章:How to read this book
bash·shell·gnu·parallel
dingdingfish2 天前
GNU Parallel 学习笔记 - 总目录
bash·gnu·parallel
鸠摩智首席音效师2 天前
Linux Bash 中如何追加内容到文件 ?
linux·运维·bash
海兰2 天前
win11下部署elastic9.0+常见问题及解决方法(续)
运维·jenkins
海鸥812 天前
k8s中Jenkins 配置文件「 更新不了 」
java·kubernetes·jenkins
_运维那些事儿2 天前
GitLab&Jenkins
运维·ci/cd·gitlab·jenkins·devops
一念一花一世界2 天前
Jenkins 太重?试试超轻量开源 CI/CD 工具 Arbess
运维·ci/cd·jenkins·arbess