注册 登录
编程论坛 Linux教室

创建脚本程序

neverTheSame 发布于 2008-06-25 01:08, 1442 次点击
*/ --------------------------------------------------------------------------------------
*/ 出自: 快乐编程 https://hi.bccn.net/108519
*/ 作者: neverTheSame E-mail:zhaoxufeng9997@ QQ:475818502
*/ 时间: 2008-6-1
*/ 声明: 尊重作者劳动,转载请保留本段文字
*/ --------------------------------------------------------------------------------------
 

脚本程序的创建可以说很简单,你可以通过文本编辑器来编辑.

脚本程序有一定的规则:

脚本程序的注释:以#开头到本行结束。
脚本程序的一种特殊注释:以#!开头,它告诉系统其后面的参数是用来执行本文件的程序。
一个脚本程序:
       #!/bin/sh
   
      #first.sh
      #This file looks through all the files in the current directory
      #for the string “MYNAME”, and displays the content of those files.
      for file in *
      do
          if grep –q MYNAME $file
              then more $file
         fi
      done
      exit 0
0 回复
1