原创 [linux shell]if -else 例子
#ifelse_exam.sh腳本用於檢查輸入的字符串是否是一個當前目錄 #!/bin/bash #測試用戶輸入是否爲空,然後判斷當前目錄是否存在該文件 if [ "$1" ] then echo "What you
原创 for循環參數列表通過命令行讀入
1 #通過命令行來傳遞腳本中for循環列表參數 2 #!/bin/bash 3 4 echo "number of arguments is $#" 5 6 echo "What you input is "
原创 if-elif-else語句對學生成績進行分類
#ifelifelse_exam.sh實用if/elif/else結構對分數進行排序 #/bin/bash #提示用戶輸入分數 echo "Please Input a score [0-100]." read score #判斷學生分
原创 case語句實現數字對應月份
1 #提示用戶輸入一個數字(1-12),然後顯示其對應的月份的 英文 2 #!/bin/bash 3 4 echo "Please input a month [0-12]" 5 read month 6
原创 if-else語句對成績分A,B,C三類
#ifelse_score 腳本用於對學生成績進行分類 #!/bin/bash #提示用戶輸入分數 echo "Please Input a score [0-100]:" read score #判斷學生分數 if [ "$s