错误: line *: [: missing `]'

  写脚本时,我碰到这个问题是因为if [ ]; ...else...fi语句

  解决方法: if后面的[] (test) 和条件要有空格,如:

    对于语句 if [-f "/var/www"]; then 应该写为:

    if [ -f "/var/www" ]; then

linux脚本错误: line *: [: missing `]'的更多相关文章

  1. linux脚本错误: line *: [: missing `]',linux编写shell脚本时的注意点

    转载:https://www.cnblogs.com/bovenson/p/4548079.html 关于shell的一些注意点,粘贴自拉钩教育精选评论:测试开发核心技术 46 讲-->第6讲 ...

  2. 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令

    Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...

  3. 《The Linux Command Line》 读书笔记02 关于命令的命令

    <The Linux Command Line> 读书笔记02 关于命令的命令 命令的四种类型 type type—Indicate how a command name is inter ...

  4. 《The Linux Command Line》 读书笔记01 基本命令介绍

    <The Linux Command Line> 读书笔记01 基本命令介绍 1. What is the Shell? The Shell is a program that takes ...

  5. Linux Command Line Basics

    Most of this note comes from the Beginning the Linux Command Line, Second Edition by Sander van Vugt ...

  6. Linux Command Line 解析

    Linux Command Line 解析 0 处理模型 Linux kernel的启动包括很多组件的初始化和相关配置,这些配置参数一般是通过command line进行配置的.在进行后续分析之前,先 ...

  7. 15 Examples To Master Linux Command Line History

    When you are using Linux command line frequently, using the history effectively can be a major produ ...

  8. 10 Interesting Linux Command Line Tricks and Tips Worth Knowing

    I passionately enjoy working with commands as they offer more control over a Linux system than GUIs( ...

  9. Reso | The Linux Command Line 的中文版

    http://book.haoduoshipin.com/tlcl/book/zh/ 本书是 The Linux Command Line 的中文版, 为大家提供了多种不同的阅读方式. 中英文双语版- ...

随机推荐

  1. 目前所有的ANN神经网络算法大全

    http://blog.sina.com.cn/s/blog_98238f850102w7ik.html 目前所有的ANN神经网络算法大全 (2016-01-20 10:34:17) 转载▼ 标签: ...

  2. iOS多视图传值方式之通知传值(NSNotification;NSNotificationCenter)

    iOS传值方式之5:通知传值 第一需要发布的消息,再创建NSNotification通知对象,然后通过NSNotificationCenter通知中心发布消息(NSNotificationCenter ...

  3. 编写一个python脚本功能-备份

    版本一 解决方案当我们基本完成程序的设计,我们就可以编写代码了,它是对我们的解决方案的实施.版本一例10.1 备份脚本——版本一 #!/usr/bin/python # Filename: backu ...

  4. ISP和IAP

    ISP(在系统编程)是一种不依赖于单片机自身软件的程序下载方式,特点是不需要从电路板上取下单片机,通过某种方式使单片机进入ISP模式,开放编程接口,由其使用的计算机将新的程序代码写入到存储器内.我们平 ...

  5. C#常用网址

    C# 编程指南 https://msdn.microsoft.com/zh-cn/library/67ef8sbd.aspx

  6. java语法:字符串数组的赋值

    字符串数组怎么赋值呢? 首先当然得先定义啦:String infoPack[] : 然后想当然的以为在for循环里,new一个数组, String infoPack[i] = imgurls; 事实证 ...

  7. Java IO面试

    1. 讲讲IO里面的常见类,字节流.字符流.接口.实现类.方法阻塞. 字节流和字符流的区别: 1)字节流处理单元为1个字节,操作字节和字节数组,而字符流处理的单元为2个字节的Unicode字符,分别操 ...

  8. bzoj3932

    3932: [CQOI2015]任务查询系统 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 1326  Solved: 480[Submit][Sta ...

  9. C#通过socket判断FTP服务器是否通畅并判断用户名密码是否正确

    private static ManualResetEvent timeoutObject; private static Socket socket = null; private static b ...

  10. chrome的功能Copy as cURL

    https://segmentfault.com/q/1010000002508961