问题描述
我可以从下面的代码中安装MySQL或任何软件包,但我希望从一个脚本中一个接一个地安装多个软件包.
I can install MySQL or any package from the code below but I wish to install multiple packages, one by one, from a single script.
echo "Do you wish to install MySql?"
select yn in "Yes" "No"; do
case $yn in
Yes ) yum -y install mysql; break;;
No ) exit;;
esac
done
1).如果键入 No
,它将继续进入下一个级别,例如您是否要安装Apache
.
1). If type No
then it will go on to next level e.g.Do you wish to install Apache
.
2).如果键入是
,它将安装MySQL,然后询问下一个软件包,例如您是否要安装Apache
.
2). If type Yes
it will install MySQL then ask for next packages e.g.Do you wish to install Apache
.
有人可以帮我写这个脚本吗?
Could someone help me writing this script?
我会向你解释.我想为 MySQL + Apache + PHP 安装创建脚本.
如果我的计算机上已经安装了 MySQL ,我不想安装它,那么它将询问我是否要安装 Apache ?如果我按1它将安装,然后它将要求我.是否要安装 PHP ,然后自动退出.
I will explain to you. I want to create script for MySQL + Apache + PHP installation.
If MySQL is already installed in my machine, I don't want to install it, then it will ask for me Do you wish to install Apache? if I press 1 it install then it will ask for me Do you wish to install PHP then exit automatically.
推荐答案
用于Bourne shell的脚本片段的正确语法为:
Correct syntax for your script snippet for Bourne shell would be:
echo "Do you wish to install MySql?"
read yn
case "$yn" in
Yes)
yum install mysql
;;
No) ;;
esac
这篇关于mysql + apache + php安装脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!