--------------------------------------------------------------- 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) |