由於語法渲染問題而影響閱讀體驗, 請移步博客閱讀~
本文GitPage地址

If & whle & case

  1. if [ 1 -eq 1 ] #expression
  2. then
  3. #Statement(s) to be executed if expression is true
  4. echo Yes
  5. fi

字符串判断

  1. ##https://blog.csdn.net/Primeprime/article/details/79625306
  2. strA="long string"
  3. strB="string"
  4. result=$(echo $strA | grep "${strB}")
  5. if [[ "$result" != "" ]]
  6. then
  7. echo "包含"
  8. else
  9. echo "不包含"
  10. fi

while

  1. while [ expression ]
  2. do
  3. Statement(s) to be executed if expression is true
  4. done

try

reference:筱光

  1. { # try
  2. command1
  3. #save your output
  4. } || { # except
  5. # save log for exception
  6. }

Enjoy~

本文由Python腳本GitHub/語雀自動更新

由於語法渲染問題而影響閱讀體驗, 請移步博客閱讀~
本文GitPage地址

GitHub: Karobben
Blog:Karobben
BiliBili:史上最不正經的生物狗