且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用apt-get命令制作脚本?

更新时间:2023-02-02 20:39:49

这是一个如何用一行完成该操作的示例,并假定您使用sudo运行脚本或具有适当的特权.

This is an example of how to do it with one line and assumes you are running the script with sudo or have appropriate privilege.

apt-get -qq update && apt-get -qq --yes --force-yes install tcl

-qq禁止输出,除非发生错误

-qq suppresses output unless an error occurs

--yes回答提示您要继续吗? [Y/n]'

--yes answers the prompt 'Do you want to continue? [Y/n]'

--force-yes安装来自私有存储库的软件包

--force-yes installs packages that come from a private repository

考虑在脚本中更早地运行apt-get update &.使用apt-get install

Consider running apt-get update & earlier in the script. Check or wait for the job to finish before using apt-get install

您可以在一行上列出多个软件包.软件包按照列出的顺序安装.

You can list multiple packages on one line. Packages are installed in the order they are listed.