ubuntu22.04 一次性安装多个软件包脚本

#!/bin/bash
package_list=(autoconf automake bc binutils binutils-gold bison build-essential bzip2 cmake curl device-tree-compiler \
    dpkg-dev flex g++ gcc git gperf imagemagick libssl-dev libtool linux-kernel-headers m4 make ncurses-dev \
    patch perl quilt texinfo unzip xz-utils)

install_error=0
install_log=/tmp/build_package_install.log

echo "==============================" > $install_log
sudo apt-get update

for p in "${package_list[@]}"; do
    echo "============================="
    echo "Installing package <$p> ..."
    sudo apt-get install -y $p >> $install_log
    install_error="$?"
    if [[ "$install_error" == "0" ]]; then
        echo "Package <$p> install success!"
    else
        echo "Package <$p> install error!"
    fi
done

echo "Package install over, See log at $install_log"

你可能感兴趣的:(linux技巧,linux)