apt-get 的 -qq 参数是什么意思?

apt-get 的 -qq 参数是什么意思?

我刚刚收到Vagrant文​​件以及安装后 bash 脚本。vagrantfile 下载标准Ubuntu来自 Ubuntu Cloud,但我在 bash 脚本中发现了一些东西。

脚本如下:

apt-get update -qq > /dev/null
apt-get -qq -y install apache2 > /dev/null

我尝试在互联网上搜索-qqshell 脚本中的含义,但没有找到任何相关信息,因此,我在这里询问是否有人知道它的含义。

据我所知,这> /dev/null意味着正在进行的进程不会打印在屏幕上,因为它不需要标志-qq。所以,我真的很想知道。

答案1

-qq是一个标志,可以apt-get减少噪音。

-qq No output except for errors

您对 的说法是正确的>/dev/null。通过重定向所有 STDOUT, 就-qq变得多余了。

答案2

使它-qq非常安静,而不仅仅是安静。但从我的手册页来看,它还暗示-y--assume-yes,对问题回答“是”),并且该手册警告使用-qq

来自手册页

请注意,安静级别 2 意味着 -y,您绝不应该使用 -qq 而不使用无操作修饰符(例如 -d、--print-uris 或 -s),因为 APT 可能会决定做一些您意想不到的事情。

您可以要求该脚本的开发人员检查一下。

答案3

在这种情况下,-qq可以选择 apt-get 而不是 bash。如果您执行 man apt-get,您将获得 apt-get 的文档。

意思是“非常安静”

-q, --quiet
    Quiet. Produces output suitable for logging, omitting progress indicators. More q's will produce more quiet up to a maximum of two. You can also use -q=# to set the quiet level, overriding the configuration file. Note that quiet level 2 implies -y, you should never use -qq without a no-action modifier such as -d, --print-uris or -s as APT may decided to do something you did not expect.

因此,总结一下,对 的调用apt-get将比 更冗长,而apt-get -q又比 更冗长apt-get -qq

通常,查找命令帮助的第一个地方是该命令的“man”页面。 man是一个标准的 Linux 命令,它将显示给定命令的帮助。 因此,对于您的情况,man apt-get它将为您提供 apt-get 命令的帮助。

相关内容