Shell Script Implementation command line multilevel menu (no specific function)

Source: Internet
Author: User

#!/bin/bash

#auth chentp0601

#date 20151123

Function menu ()

{

Clear

Cat <<eof

#this is Base menu

1.[install Lamp]

2.[install LNMP]

3.[exit]

Eof

Read-p "Please input 1-3:" List

Case $list in

"1")

While True

Do

Menu_lamp

Done

;;

"2")

While True

Do

Menu_lnmp

Done

;;

"3")

Echo-e "exiting ... \ n";

Sleep 1

Exit 0

;;

*)

Continue

;;

Esac

}


function Menu_lamp ()

{

Clear

Cat <<eof

#this is lamp menue

1.[install Apache]

2.[install MySQL]

3.[install PHP]

4.[back]

Eof

Read-p "Please input 1-3:" List1

Case $list 1 in

"1")

ECHO-E "Installing apache\n"

Sleep 2

Continue

;;

"2")

ECHO-E "Installing mysql\n"

Sleep 2

;;

"3")

ECHO-E "Installing Php\n"

Sleep 2

;;

"4")

Break

;;

*)

Continue

;;

Esac

}



function Menu_lnmp ()

{

Clear

Cat <<eof

#this is lnmp menu

1.[install Nginx]

2.[install MySQL]

3.[install PHP]

4.[back]

Eof

Read-p "Please input 1-4:" List2

Case $list 2 in

"1")

ECHO-E "Installing nginx\n"

Sleep 2

Continue

;;

"2")

ECHO-E "Installing mysql\n"

Sleep 2

;;

"3")

ECHO-E "Installing Php\n"

Sleep 2

;;

"4")

Break

;;

*)

Continue

;;

Esac

}


While True

Do

Menu

Done


This article is from the "Advance Bar Rookie" blog, please make sure to keep this source http://chentp.blog.51cto.com/10638759/1716086

Shell Script Implementation command line multilevel menu (no specific function)

Related Article

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.