shell Exercise 3

1 outputs the following menu .----------------------- >>>>>>>
  1.install the MySQL
  2.install the Tomcat
  3.exit
When the user selects a corresponding digital service corresponding to the installation start (output echo may alternatively), the user needs to input digital determined whether (test conditions used to achieve expression) is an integer.

! # / bin / bash
# Author: WQS-Lirrard
# Blog: https://www.cnblogs.com/wqs-Time/
# Time: 2019-04-29 20:36:09
# the Name: 4.sh
# Version : v1.0
# the Description:. This IS A Script
CAT << EOF
    enter the following menu
 ===========================
1.install MySQL
2.install Tomcat
3.exit
===========================
EOF
the Read -p "Please enter the number you want to operate:" a
a +. 1 & $ expr> / dev / null
IF [-eq $ 0?]; the then
  IF [$ a $ a -LT--gt -a 0. 4]; the then
  echo "of the user input digital a $"
  the else
  echo "invalid number"
  Exit 2
  fi
the else
  echo "Please enter the correct number."
  exit 1
fi
if [ $a -eq 1 ];then
  echo "Installing the install -Y yum the MySQL >>> -----"
  SLEEP 2
  echo "After two seconds, MySQL successfully installed"
  Exit 0
elif [$ A -eq 2]; the then
  echo "Installing --- - >>> -Y yum the install the Tomcat "
  SLEEP 2
  echo" after two seconds, Tomcat installed successfully "
  exit 0
the else
  echo" exiting "
  exit. 1
Fi

 

 

Guess you like

Origin www.cnblogs.com/wqs-Time/p/11391178.html