zoukankan      html  css  js  c++  java
  • if语句的使用

    shell格式的if语句:

    [root@www file_test]# cat if.sh
    #!/bin/bash
    #if test
    if [ $# -eq 0 ];then
      exit
    fi
    if [ $1 -eq 1 ];then
      echo "the num is : abc"
    elif [ $1 -gt 2 ];then
      echo "the num is : 2-200"
    else
      echo "the num is other"
    fi
    [root@www file_test]#

    多分支if条件语句

        if [ 条件语句1 ]

           then

            执行程序1

        elif [ 条件语句2 ] 

          then

            执行程序2

         else

          执行程序2 

         fi

    awk格式的if语句:
    [root@www file_test]# awk -F: '{if($3==0){print "管理员账号:"$1}else if($3>=1 && $3<1000){i++}else{j++}}END{print "系统账号个数:"i;print "普通账号个数:"j}' passwd
    管理员账号:root
    系统账号个数:31
    普通账号个数:1
    [root@www file_test]#

  • 相关阅读:
    C# 使用SMTP发送附件
    C# 获取文件名及扩展名
    邮件添加附件
    WPF 加载GIF动画
    IIS端口被占用 转载
    ReDim Preserve 的用途
    c# 构造函数执行顺序
    WriteLog
    SMS发送短信设置HttpWebRequest
    Directory.GetFiles
  • 原文地址:https://www.cnblogs.com/xiaofeng666/p/12660069.html
Copyright © 2011-2022 走看看