#!/bin/bash read -p 请输入要下载的软件包: software source /etc/os-release if [ $ID centos ] || [ $ID rhel ];then yum install -y $software elif [ $ID ubuntu ] || [ $ID debian ];then apt-get install -y $software echo $software 已经安装完成 else echo 请输入正确的软件包名 fi