高效安装依赖

编译安装时,查找和安装依赖比较繁索,我想把查找和安装放在一起,并且一真等待输入,可以一直安装.

如果输入 next 表示再次查找,输入exit 退出.

function quick.install(){


              [ -z `which sudo` ] && apt install -y sudo

                local software=""
                until [ "$software" == 'exit' ]
                do
                   
                    echo -en "\033[31m查找: \033[0m"
                    read software

                    [ "$software" == 'exit' ] && break
                    apt list "$software*";
                    software="lib$software"
                    apt list "$software*";

                    echo -en "\033[31m安装: \033[0m"
                    read software

                    if [ "$software" == 'next' ];then
                        continue
                    elif [ "$software" == 'exit' ];then
                        break
                    fi

                    sudo apt install -y $software && echo $software >> ~/install.log

                done


}                 

 

posted @ 2020-12-14 20:01  心随所遇  阅读(111)  评论(0编辑  收藏  举报