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). If type No
then it will go on to next level eg Do you wish to install Apache
.
2). If type Yes
it will install MySQL then ask for next packages eg Do you wish to install Apache
.
Could someone help me writing this script?
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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.