shell 脚本 if then else fi
时间:2016-12-22 15:39 来源:linux.it.net.cn 作者:IT
--------------------------------------------------------------- echo "Please y to continue" read yn if [ "$yn" = "y" ] || [ "$yn" = "Y" ]; then echo "script is running..." else echo "stop!" fi 注意有空格哦------------------------------------------ if [ "$1" = "hello" ] ; then echo "hello!" elif [ "$1" = "" ]; then echo " no parameter" else echo "only hello " fi [dev@abtsvr shellTest]$ sh test6.sh no parameter [dev@abtsvr shellTest]$ sh test6.sh hhh only hello [dev@abtsvr shellTest]$ sh test6.sh hello hello! ---------------------------------------------------------------------------------- (责任编辑:IT) |