0
点赞
收藏
分享

微信扫一扫

vue 点击获取元素的css属性

萨科潘 2024-07-24 阅读 34

linux执行脚本sh xxx.sh报错:$'xxx\r': 未找到命令

原因:shell脚本在Windows编写导致的换行问题: Windows 的换行符号为 CRLF(\r\n),而 Unix\Linux 为 LF(\n)。

缩写全称ASCII转义说明
CRCarriage Return\r回车
LFLinefeed\n换行,Unix\Linux 的换行符
CRLFCarriage Return & Linefeed\r\n回车并换行,Windows 的换行符

解决:

# 查看文件格式信息
$ file xxx.sh
xxx.sh: a /usr/bin/env bash\015 script, ASCII text executable, with CRLF line terminators

#-----------------------------------------------
# 转换为 Unix 格式换行
$ vim xxx.sh
:set ff=unix
:wq
#-----------------------------------------------

# 再次查看文件格式信息
$ file xxx.sh
xxx.sh: a /usr/bin/env bash script, ASCII text executable
举报

相关推荐

0 条评论