但是运行时总是报下面这个错,如下:

test11-loop.sh: 5: Syntax error: Bad for loop variable

几经查找语法,没有问题,后来在网上找到问题原因:

代码对于标准bash而言没有错,因为Ubuntu为了加快开机速度,用dash代替了传统的bash,是dash在捣鬼。
解决方法是 取消dash
sudo dpkg-reconfigure dash
在选择项中选No,即可。

(转)Syntax error:的更多相关文章

  1. Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"

    同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...

  2. myeclipse中导入js报如下错误Syntax error on token "Invalid Regular Expression Options", no accurate correc

    今天在使用bootstrap的时候引入的js文件出现错误Syntax error on token "Invalid Regular Expression Options", no ...

  3. Linux中syntax error near unexpected token 错误提示解决方法

    Linux中syntax error near unexpected token ... 错误提示有一般有两种原因: 1)window和Linux下换行符不一致导致 window下的换行和Linux下 ...

  4. linux 报错 bash ‘/bin/sh: Syntax error: “(” unexpected

    今天用make 编译 蹦到 bash ‘/bin/sh: Syntax error: “(” unexpected 和 /bin/sh: [[: not found 这种莫名奇妙的错误 原因是是lin ...

  5. AspNetPager控件报错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$Aspnetpager1_input问题解决[摘]

    高版本IE,如IE10或者IE11在浏览页面时出现错误: Syntax error, unrecognized expression: input#ctl00$ContentPlaceHolder1$ ...

  6. syntax error near unexpected token `then'问题的解决

    #!/bin/bash #if program test echo 'a:' read a if  [  "$a"  =  "English"  ];then ...

  7. JS function document.onclick(){}报错Syntax error on token "function", delete this token

    JS function document.onclick(){}报错Syntax error on token "function", delete this token func ...

  8. linux shell 报错 Syntax error: Bad for loop variable

    在linux下写了一个简单的shell,循环10次. test.sh #!/bin/bash ## ##循环10次 ## ; i<; i++)); do echo Good Morning ,t ...

  9. 一个参数大小写引发的uploadify报错 "Syntax error, unrecognized expression: #"

     上传控件uploadify 报错"Syntax error, unrecognized expression: #" 版本为 uploadify3.2  报错原因:参数ID[hi ...

  10. 使用cygwin出现syntax error near unexpected token'$'do\r

    直接从csdn复制粘贴的.sh代码,放到cygwin下运行sh的时候出错syntax error near unexpected token'$'do\r 解决方法: 1.下载notepad++ 2. ...

随机推荐

  1. python学习第一周(1)

    备注:一般规范代码,可以操作code-reformat code 1. #!/usr/bin/env python 脚本语言第一行 作用:文件中代码用指定可执行程序运行,在unix类的操作系统才有意义 ...

  2. Expect 安装 on centos7

    本文演示如何在CentOS7上安装和使用Expect. 使用场景 在主机A上编写并且执行Shell脚本,Shell脚本中需要ssh到主机B上执行交互命令. 安装 在主机A上安装expect: yum ...

  3. The stacking context

    文档中的层叠上下文由满足以下任意一个条件的元素形成: 1. z-index 值不为 "auto"的 绝对/相对定位. 2. position位fixed. 3. opacity 属 ...

  4. CRM原型

    https://files.cnblogs.com/files/wcLT/CRM.zip

  5. AOP缓存实现

    输入参数索引作为缓存键的实现 using MJD.Framework.CrossCutting; using MJD.Framework.ICache; using System; using Sys ...

  6. Cannot find wrapper assembly for type library "ADODB". in VS2017

    Delete Microsoft ActiveX Data Objects {version} Library and then add it back. After resolving the pr ...

  7. mybatis学习--缓存(一级和二级缓存)

    声明:学习摘要! MyBatis缓存 我们知道,频繁的数据库操作是非常耗费性能的(主要是因为对于DB而言,数据是持久化在磁盘中的,因此查询操作需要通过IO,IO操作速度相比内存操作速度慢了好几个量级) ...

  8. Linux的命名空间详解--Linux进程的管理与调度(二)【转】

    Linux Namespaces机制提供一种资源隔离方案. PID,IPC,Network等系统资源不再是全局性的,而是属于特定的Namespace.每个Namespace里面的资源对其他Namesp ...

  9. Windows10 内存泄漏

    之前遇到win10开机idle一段时间后, 内存噌噌的往上彪, 16G内存基本什么东西没开就90%多.查了网上的一些解决方案: 方法1. 关闭Ndu服务 sc config Ndu start=dis ...

  10. Class doesn't contain any JAX-RS annotated method

    项目中使用了Jersey RESTful风格的注解 , 根据错误提示就知道了 , 在类中没有带注解的方法 ,所以只要在方法上添加 @path() 注解就行了,至少要有一个方法带有Jersey注解