shell-Menu Automation software deployment

Source: Internet
Author: User

to print the selection menu, follow the Select one button to install the different Web Services.

Sample menu:

[Email protected] scripts]# shmenu.sh

1.[install Lamp]

2.[install LNMP]

3.[exit]

pls input the num you want:

Requirements:

1 1 startinstalling lamp. hint "then execute /server/scripts/lamp.sh after exiting the script, the job is formal Lamp one-click installation script;

2 2 startinstalling lnmp. hint "   output "Lnmpis Installed "

3, when input 3 , exit the current menu and script;

4, when the input any other characters, give the hint "Input error" after the exit script;

5, to the execution of the script to determine the relevant conditions, such as: whether the script file exists, whether it can be executed and so on, as far as possible to use the knowledge points previously explained.

#!/bin/bashpath=/server/scripts[ ! -d  "$path"  ] && mkdir -p $ Path#memucat <<end    1. [Install lamp]    2. [Install lnmp]    3. [exit]    pls input the num you want:endread numexpr $ num + 1 &>/dev/null[ $? -ne 0 ] &&{     echo  "The num you input must be {1|2|3}"     exit  1}case  $num  in 1) echo  "Start installing lamp" sleep 3[ -x  "$ path/lamp.sh " ]| | {  echo  "$path/lamp.sh does not exist or can not be  exec. "   exit 1} $path/lamp.sh       #脚本文件   exit $?;; 2)  echo  "Start installing lnmp" &NBSP;&NBSP;&NBSP;&Nbsp;    sleep 3        [ -x  "$path/ lamp.sh " ]| | {          echo  "$path/lnmp.sh does not  Exist or can not be exec. "           exit 1}          $path/lnmp.sh      #脚本文件   exit $?;; 3)   echo bye.  exit 3;; *)   echo  "the num you input must be {1|2|3}"   echo   "Input error"   exit 4esac


shell-Menu Automation software deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.