服務安裝菜單示例腳本

#!/bin/bash
#service script
menu () {
cat <<END
1 [install lamp]
2 [install lnmp]
3 [exit]
pls input the num you want:
END
}
menu
script1=/server/scripts/lamp.sh
script2=/server/scripts/lnmp.sh
read int
case "$int" in
1)
if [ -x $script1 ]
then
echo "start installing lamp."
/bin/sh $script1
else
echo "this script cannot be used."
exit 1
fi
;;
2)
if [ -x $script2 ]
then
echo "start installing lnmp."
/bin/sh $script2
else
echo "this script cannot be used."
exit 1
fi
;;
3)
exit 0
;;
*)
echo "lnput error."
exit 2
esac

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章