摘要: 转自:http://blog.csdn.net/fpmystar/article/details/4183678第1部分. Linux 脚本编写基础1.1 语法基本介绍1.1.1 开头程序必须以下面的行开始(必须方在文件的第一行):#!/bin/sh 符号#!用来告诉系统它后面的参数是用来执行该文件的程序。在这个例子中我们使用/bin/sh来执行程序。 当编辑好脚本时,如果要执行该脚本,还必须使其可执行。 要使脚本可执行:编译 chmod +x filename 这样才能用./filename 来运行1.1.2 注释 在进行shell编程时,以#开头的句子表示注释,直到这一行的结束。我... 阅读全文
posted @ 2012-12-04 14:53 wust.zjf 阅读(361) 评论(0) 推荐(0) 编辑
摘要: echo1.显示普通字符串: echo "It is a test" 这里的双引号完全可以省略 echo It is a test 效果与上面一致2.显示转义字符 echo "\"It is a test\"" 结果将是: "It is a test" 同样,双引号也可以省略3.显示变量 read name (输入OK) echo "$name It is a test" 结果将是: OK It is a test 同样双引号也可以省略 如果变量与其它字符相连的话,需做如下处理: read mo 阅读全文
posted @ 2012-12-04 14:51 wust.zjf 阅读(1995) 评论(0) 推荐(0) 编辑