linux-tutorial/codes/linux/dunwu-soft.sh
2019-05-16 11:49:19 +08:00

47 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
cat << EOF
***********************************************************************************
* 欢迎使用 Linux CentOS 软件安装配置脚本
* @author: Zhang Peng
***********************************************************************************
EOF
menus=("git" "zsh" "jdk8" "maven" "nodejs" "mongodb" "redis" "tomcat8" "kafka" "rocketmq" "zookeeper")
printMenu() {
for i in "${!menus[@]}"; do
index=`expr ${i} + 1`
val=`expr ${index} % 2`
printf "(%02d) %-20s" "${index}" "${menus[$i]}"
if [[ ${val} -eq 0 ]]; then
printf "\n"
fi
done
printf "\n请输入需要安装的软件编号\n"
}
main() {
read -t 30 index
if [[ -n $index ]]; then
no=`expr ${index} - 1`
len=${#menus[*]}
if [[ ${index} -gt ${len} ]]; then
echo "输入项不支持!"
exit -1
fi
key=${menus[$no]}
curl -o- https://gitee.com/turnon/linux-tutorial/raw/master/codes/linux/soft/${key}-install.sh | bash
else
echo "输入项不支持!"
exit -1
fi
}
######################################## MAIN ########################################
printMenu
main