zoukankan      html  css  js  c++  java
  • 自动编译

    (命令列第一个参数) $1 如果只等如X, 那就是变量没有内容,是空变量, 也
    是用来测试命令列上有没有参数,例如

    user@minix-nb:~$ cat a
    #! /bin/bash

    #if [ X$1 = X ]
    if[/$1 = /1/ ]

    then
    echo "the first argu is empty"
    else
    echo "the first argu is $1"
    fi
    user@minix-nb:~$ ./a
    the first argu is empty
    user@minix-nb:~$ ./a 123
    the first argu is 123
    user@minix-nb:~$


    if [ -f $home/$1]
    1.if 条件判断关键字
    2.[ ] 语法要求
    3.-f 文件比较运算符,如果 filename为常规文件,则为真
    4.$home 取变量的值,如果.sh文件里面没有该就是则会取用户系统变量!你可以在终端中执行一下 echo $home 看看是什么路径
    5.$1 取输入的第一个参数.例: sh xxx.sh 111 那么此时 $1的值就是 111

       大小为0 的  执行 

    # find / -type f -size 0 -exec ls -l {} ;

    #!/bin/sh

    if [ /$1/ = /all/ ];then

    #查找当前目录 最小深度 类型 目录 如果查到 读到变量 LANGUAGE

     find . -mindepth 1 -typy d | while read LANGAGUE; do

        #如果是build目录 进入文件

        if[ -f "$LANGAGUE"/build ];then

          cd "$LANGAGUS"

          ./build all

          #返回上一级

          cd ..

        fi

        done

        elif [ /$1/ = /clearn/ ]; then

        find . -mindepth 1 -type d | while read LANGUAGE; do

          if [ -f  "$LANGUAGE" /build  ]; then

          cd "$LANGUAGE"

          ./build clean

          cd ..

        fi

      done

    else 

    echo "syntax :build all | clean "

    fi

  • 相关阅读:
    07word转换pdf
    高德纳《计算机程序设计艺术》(The Art of Computer Programming)的作者
    DbVisualizer 8 解决中文乱码问题 (20120310 20:23)
    IT has never been easier or harder
    el表达式和s:property的区别
    df 和 du 命令详解
    dbvisualizer 8.0 破解(free>personal)
    ping 中的TTL查看操作系统
    netstat 监控TCP/IP网络
    ls l 命令
  • 原文地址:https://www.cnblogs.com/countryboy666/p/11049040.html
Copyright © 2011-2022 走看看