是linux无法解析$'\r'。这其实是windows与linux系统的差异导致的。

因为linux上的换行符为\n,而windows上的换行符为\r\n。所以脚本到linux上就无法解析了。

通常的处理办法主要有2种:

处理办法1 set ff=unix
vi hello.sh
### Esc进入命令行运行模式
### : set ff=unix 处理办法2 dos2unix
dos2unix hello.sh
### 如果报command not found 是因为你没有安装,安装dos2unix插件即可。
---------------------
作者:在风中的意志
来源:CSDN
原文:https://blog.csdn.net/u010416101/article/details/80135293
版权声明:本文为博主原创文章,转载请附上博文链接!

Linux 错误: $'\r': command not found的更多相关文章

  1. Linux Shell 错误: $'\r': command not found错误解决

    在Linux下执行程序最省事的方式就是将系统的执行流程封装成一个shell脚本,上传到linux环境中后就可以直接执行了,但是今天在具体实施的时候出现了错误 $'\r': command not fo ...

  2. 执行shell脚本出错'\r': command not found

    在linux中执行脚本时出错 $'\r': command not found 错误原因是在脚本中有空行,如果脚本是在Windows下进行编辑之后上传到linux上去执行的话,就会出现这个问题. 因为 ...

  3. shell脚本执行错误 $'\r':command not found

    shell脚本执行错误 $'\r':command not found Linux下有命令dos2unix 可以用一下命令测试 vi -b filename 我们只要输入dos2unix *.sh就可 ...

  4. $'\r': command not found 或者 syntax error: unexpected end of file 或者 syntax error near unexpected token `$'\r''

    执行shell脚本如果报如下错误: syntax error near unexpected token `$'\r'' syntax error: unexpected end of file $' ...

  5. shell脚本遇到问题"$'\r': command not found"

    shell脚本写得一切正常,但是一执行就报错: line: XXX "$'\r': command not found" 问题原因:文件格式问题(虽然在window和linux上选 ...

  6. $'\r': command not found

    在Linux下执行程序最省事的方式就是将系统的执行流程封装成一个shell脚本,上传到linux环境中后就可以直接执行了,但是今天在具体实施的时候出现了错误 $'\r': command not fo ...

  7. 解决shell脚本错误$’r’ command not found

    从windows上传了一个脚本到Linux上执行 出现如下错误:$'\r': command not found这是windows与Unix文本编辑的默认格式不同造成的,需要转成unix格式. 解决方 ...

  8. linux 中\r

    工作中遇到的一个处理\r和\n的问题,看了一下\r是啥... void File_translater::EspEntr(string& strSrc){ int iPos; while((i ...

  9. Shell脚本出现$'\r': command not found

    Centos7下执行shell脚本报错如下 [root@ip---- ~]# sh install_zabbix_agent.sh install_zabbix_agent.: $'\r': comm ...

  10. 解析Linux下\r\n的问题(回车和换行)

    http://www.jb51.net/article/37389.htm 深入解析Linux下\r\n的问题 http://www.ruanyifeng.com/blog/2006/04/post_ ...

随机推荐

  1. css页面网址

    前端必看的文章 1.CSS设置居中的方案总结  https://juejin.im/post/5a7a9a545188257a892998ef 2.阮一峰老师的网站 http://www.ruanyi ...

  2. LeetCode Array Easy 27. Remove Element 解题

    Given an array nums and a value val, remove all instances of that value in-place and return the new ...

  3. ASE——热身作业自我介绍

    自我介绍 大家好我是王皓,由于之前忙于保研的机试和面试导致第一次作业就拖到第二次写blog的时候才交(非常抱歉..)我喜欢玩CTF,觉得学习安全方向的知识,寻找软件或者硬件的漏洞是一件非常有意义且有趣 ...

  4. js实现点击按钮控制展开与收起.

    html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...

  5. mysql查询相关

    查询事务 SELECT * FROM information_schema.INNODB_TRX\G; 查询正在锁的事务 SELECT * FROM INFORMATION_SCHEMA.INNODB ...

  6. ansible-继续普通用户权限运行

    ansible 远程以普通用户执行命令   1. ansible 10.0.0.1 -m raw -a "date" -u www 2.在ansible的主机配置文件中指定ssh_ ...

  7. bypass_safedog

    1.SQL注入 手工bypass要点 先通过破坏关键字测试出拦截规则 之后进行针对性绕过 1.Mysql 1.1.联合注入 0x01 and绕过 直接 and 1=1 直接就会被拦截 在数值的前面加特 ...

  8. PyCharm Change Font Size

    file->settings->colors&fonts-> save as (save the current scheme as your own)-> font- ...

  9. python自动化测试-使用第三方python库技术实现

    转载自https://www.cnblogs.com/beer/p/5418471.html

  10. microservice-cloud-03-provider-product-8001

    server:  port: 8001 mybatis:  config-location: classpath:mybatis/mybatis.cfg.xml        # mybatis配置文 ...