如何使用apt-get命令制作脚本? [英] How to make a script with apt-get commands?

查看:230
本文介绍了如何使用apt-get命令制作脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个安装tcl插件的脚本.

I'm doing a script which installs a tcl plugin.

但是这个tcl插件需要一些其他的tcl/tk库,因此我正在考虑放置一个APT-GET install命令来安装这些库.

But this tcl plugin require some additional tcl/tk libraries, so I was thinking about putting an APT-GET install command for installing these libraries.

是否可以在脚本(可以是Shell脚本,Perl甚至是Tcl)中使用APT-GET安装命令?

Is there a way to use the APT-GET install command in a script (it can be Shell script, Perl or even Tcl)?

推荐答案

这是一个如何用一行完成该操作的示例,并假定您使用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.

这篇关于如何使用apt-get命令制作脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆