直接从csdn复制粘贴的.sh代码,放到cygwin下运行sh的时候出错syntax error near unexpected token'$'do\r

解决方法:

1.下载notepad++

2.用notepad plus打开这个.sh文件,右击使用这个打开,视图->显示符号->显示所有符号

发现后面都是windows下的空格CRLF,

3.我们改为linux下的。。编辑->文档格式转换->转换为UNIX格式:保存

4.在cycwin下运行这个.sh就ok了

使用cygwin出现syntax error near unexpected token'$'do\r的更多相关文章

  1. 写shell,运行出错:syntax error near unexpected token `$’do\r”

    cygwin下面写shell,运行出错:syntax error near unexpected token `$’do\r” 写shell,运行出错:syntax error near unexpe ...

  2. Linux 中出现的-bash: syntax error near unexpected token `

    版权声明:本文为博主原创文章,未经博主允许不得转载. 在Linux 5中导入数据时,出现下面的错误. -bash: syntax error near unexpected token `(' 检查了 ...

  3. -bash:syntax error near unexpected token '('

    在Xshell5中编写int main(int argc,char** argv)时, 出现-bash:syntax error near unexpected token '('  : 可是我是按照 ...

  4. linux后台执行./run.py提示python syntax error near unexpected token `('

    python脚本中的#!/usr/bin/python     估计有不少人注意过一些python脚本开头有这么行东东: #!/usr/bin/python 它是用来干嘛的?貌似没有它对脚本功能也没啥 ...

  5. shell编程报错:“syntax error near unexpected token `”

    今天写了个shell脚本,在自己机器上运行正常,给同事,运行报错syntax error near unexpected token `,左看右看shell脚本没有问题,没有办法google搜索,发现 ...

  6. libtool: syntax error near unexpected token `]*

    ../libtool: line 543: syntax error near unexpected token `]*' ../libtool: line 543: `      *[\[\~\#\ ...

  7. syntax error near unexpected token‘(

    用虚拟机的时候出现这样的: 上网查了资料之后,在括号"( " 前加上"$"字符就暂时不会提示出错了.

  8. syntax error near unexpected token `then'

    #!/bin/bashclearfunction test{   if[$1 -eq "root"]&&[$2 -eq "123456"]    ...

  9. shell脚本启动语法错误syntax error near unexpected token '{

    执行shell脚本时失败,报语法错误,但脚本内容检查正常 原因为该脚本是在非Linux系统下编辑之后放到系统执行的,文件模式类型非Linux系统匹配的模式类型. 查看文件的模式类型 显示文件的模式类型 ...

随机推荐

  1. Linux_系统管理命令(工作中经常使用到的)

    查看网络配置信息 ifconfig 查看系统资源信息(类似win系统资源管理器) top (ps: load average 负载 Task 进程   Cpus/Mem  swap 交换分区 类似wi ...

  2. Ubuntu FTP 配置

    1. apt-get install vsftpd 2. vim /etc/vsftp.conf #禁止匿名访问 anonymous_enable=NO #接受本地用户 local_enable=YE ...

  3. Spring.Net 配置文件

    方法一. 直接在程序配置文件中配置 <configuration> <configSections> <sectionGroup name="spring&qu ...

  4. 改centos7的网卡名

    学习参考的文章,地址双手奉上http://www.linuxidc.com/Linux/2015-09/123396.htm 1.查看服务器的流量使用情况,执行命令cat /proc/net/dev ...

  5. ssh框架开发问题

    Struts + spring MVC + hibernate   6.1   从职责上分为表示层.业务逻辑层.数据持久层和域模块层四层. 其中使用Struts作为系统的整体基础架构,负责MVC的分离 ...

  6. tomcat域名问题

    首先可以确认,tomcat支持以下的配置: 1.同一个tomcat配置多个端口来发布不同的应用,配置多个<Service>即可; 2.同一个tomcat可以配置多个虚拟主机,以指定不同的域 ...

  7. 允许浏览器跨域访问web服务端的解决方案

    今天和同事探讨了前后端如何真正实现隔离开发的问题,如果前端单独作为服务发布,势必会涉及到无法直接调用后端的接口的问题,因为浏览器是不允许跨域提交请求的. 所谓跨域访问,就是在浏览器窗口,和某个服务端通 ...

  8. 计算alert弹出框的次数

    (function() { var oldAlert = window.alert, count = 0; window.alert = function(a) { count++; oldAlert ...

  9. 【iCore3 双核心板】例程十四:FATFS实验——文件操作

    实验指导书及代码包下载: http://pan.baidu.com/s/1dEpechF iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...

  10. 【iCore3 双核心板_FPGA】实验二十四:Niosii——SDRAM读写实验

    实验指导书及代码包下载: http://pan.baidu.com/s/1c2xAJT2 iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...