zoukankan      html  css  js  c++  java
  • case使用例子

    echo 'Input a number between 1 to 4'
    echo 'Your number is:c'
    read aNum
    case $aNum in
        1)  echo 'You select 1'
        ;;
        2)  echo 'You select 2'
        ;;
        3)  echo 'You select 3'
        ;;
        4)  echo 'You select 4'
        ;;
        *)  echo 'You do not select a number between 1 to 4'
        ;;
    esac


    #!/bin/bash
    
    option="${1}"
    case ${option} in
       -f) FILE="${2}"
          echo "File name is $FILE"
          ;;
       -d) DIR="${2}"
          echo "Dir name is $DIR"
          ;;
       *) 
          echo "`basename ${0}`:usage: [-f file] | [-d directory]"
          exit 1 # Command to come out of the program with status 1
          ;;
    esac
  • 相关阅读:
    python023
    python019
    python018
    python017
    python016
    python013
    python012
    数据库,盘它!!!!
    网络编程
    面向对象简述
  • 原文地址:https://www.cnblogs.com/chenxiaoyong/p/6230884.html
Copyright © 2011-2022 走看看