歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> Shell中的if else語句小演示

Shell中的if else語句小演示

日期:2017/3/1 14:46:53   编辑:SHELL編程
Shell中的if else語句小演示 安安靜靜學習小shell,今天看到if else 喽~ 下面這個腳本是判斷用戶執行腳本的參數,如果是hello的話,就顯示how are you 如果什麼都沒有,就提示輸入 如果參數不是hello,就提示輸入hello 代碼也很簡單~ #!/bin/bash if [ "$1" == "hello" ];then echo how are you ! elif [ "$1" == "" ];then echo please input parameter else echo please input hello fi 需要注意的是後面的fi別忘了寫哦~我第一次就忘寫了。。
Copyright © Linux教程網 All Rights Reserved