#!/bin/bash

安装make和gcc脚本

判断系统发行版

if [ -f /etc/redhat-release ]; then release="centos" elif [ -f /etc/lsb-release ]; then release="ubuntu" else echo "Unsupported Linux distribution, please install make and gcc manually" exit 1 fi

安装命令

if [ $release == "centos" ]; then rpm -q make >/dev/null || yum install -y make rpm -q gcc >/dev/null || yum install -y gcc elif [ $release == "ubuntu" ]; then dpkg -l make >/dev/null || sudo apt-get install -y make dpkg -l gcc >/dev/null || sudo apt-get install -y gcc fi

echo "make and gcc have been installed successfully

给我写一个shell脚本针对不同linux发行版调用不同的安装命令安装make和gcc如果已经安装了就直接退出

原文地址: https://www.cveoy.top/t/topic/fq3f 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录