/***************************************************************************
* [: xxxx: Unexpected operator
* 说明:
* 在修改shell脚本的时候遇到这个问题,记录一下解决方法。
*
* 2017-2-7 深圳 南山平山村 曾剑锋
**************************************************************************/ 一、参考文档:
. [ :Unexpected operator in shell programming [duplicate]
http://stackoverflow.com/questions/3411048/unexpected-operator-in-shell-programming 二、解决办法:
. 原因:There is no mistake in your bash script. But you are executing it with sh which has a less extensive syntax。
. 将shell脚本第一行#!/bin/sh换成#!/bin/bash

[: xxxx: Unexpected operator的更多相关文章

  1. 解决Linux下编译.sh文件报错 “[: XXXX: unexpected operator”

    本人经常在Linux通过编译 .sh文件来生成工程,之前一直都没问题,代码一直都没变,但是今天编译的时候,却提示错误:

  2. ubuntu16.04 : 4: [: y: unexpected operator

    Ubuntu16.04 执行行脚本出错 在使用sh 执行脚本 出错标志 : 4: [: y: unexpected operator 原因:sh是连接到dash的,又因为dash跟bash的不兼容所以 ...

  3. [: 11: y: unexpected operator问题

    <私房菜>上的shell脚本问题: 转载:[: 11: y: unexpected operator问题 脚本如下:% #!/bin/bash # Program: # This prog ...

  4. 解决Linux下编译.sh文件报错 unexpected operator Syntax error: word unexpected

    执行一个脚本  发现报语法错误,但是在其他机器上运行都没有问题 唯一的区别就是 一个是centos机器  报错的是ubuntu 网上搜索了一下 因为Ubuntu默认的sh是连接到dash的,又因为da ...

  5. hadoop单机

    Hadoop安装教程——单机模式 博客分类: 大数据 Hadoop是MapReduce的开源实现,网上有很多相关的文章,但是很多不全,有的有点乱,本人Ubuntu小白,Hadoop初学者,根据别人的资 ...

  6. lighttpd与fastcgi+cgilua原理、代码分析与安装

    原理 http://www.cnblogs.com/skynet/p/4173450.html 快速通用网关接口(Fast Common Gateway Interface/FastCGI)是通用网关 ...

  7. Linux上成功编译CoreCLR源代码

    >>Build日期:2015-2-5下午(编译失败). 开始Linux发行版用的是CentOS 6.5,操作步骤: 1)配置git: git config --global http.ss ...

  8. linux安装iscsi target,make时出错,解决方法

    安装主要是按照这个网址的步骤来的:http://ixdba.blog.51cto.com/2895551/526452 执行到make步骤时,出错: root@host:~/iscsitarget-1 ...

  9. shell用if

    --------- shell用if出错了,Why? shell if 实例: site=github.com/fankcoder if [ $site == github.com/fankcoder ...

随机推荐

  1. 7.FactoryBean 和BeanFactory去区别

    FactoryBean源码: /* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apach ...

  2. php扩展trie_filter: 利用词库, 过滤敏感词

    1. 先安装libiconv# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz# tar -zxvf libiconv- ...

  3. font awesome (图标字体库)

    Font Awesome fa是什么? 图标字体库和CSS框架 怎么用? <link rel="stylesheet" href="https://cdn.boot ...

  4. flex (html弹性布局)

    flex是什么? 任何容器都可以指定为flex布局: .box{ display: flex;  /* 行内元素可以使用:inline-flex,webket内核浏览器必须 -webkit-flex ...

  5. python 列表中字符串排序故事一则

    a = ["bca","cab","abc"] 有时候需要对列表排序 如果是对列表中整个元素 直接用sort()排序 如果想按元素的某一段排 ...

  6. centos 安装 jdk PostgreSQL

    1.下载: anzhuang  jDK http://blog.csdn.net/youzhouliu/article/details/51183115 ----------------------- ...

  7. tfboys——tensorflow模块学习(一)

    Tensorflow的基本使用 TensorFlow 的特点: 使用图 (graph) 来表示计算任务. 在被称之为 会话 (Session) 的上下文 (context) 中执行图. 使用 tens ...

  8. matlab + c/c++ opencv 混合编程

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 辛苦原创所得,转载请注明出处 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...

  9. mssql-在一个特定的会话停止出发器

    用SET CONTEXT_INFO来实现 --在某个会话里设置 SET CONTEXT_INFO 0x8888 --在触发器里判断 ) SELECT @Cinfo = Context_Info() 原 ...

  10. iBatis 简单介绍及基础入门

    iBATIS一词来源于“internet”和“abatis”的组合,是一个由Clinton Begin在2002年发起的开放源代码项目.于2010年6月16号被谷歌托管,改名为MyBatis.是一个基 ...