如何正确使用 xargs?

How can I use xargs properly?

我只想删除我本地机器上的所有 Vagrant 盒子。这是我的盒子:

$ vagrant box list
centos/7                  (virtualbox, 1509.01)
coreos-alpha              (virtualbox, 1010.1.0)

每行中的第一个字符串(例如"centos/7")似乎是盒子名称,所以我尝试了以下命令:

$ vagrant box list | awk '{ print ; }' | xargs vagrant box remove

我只是想获取第一个字符串并使用 xargs 将其传递给 vagrant box remove,因为我想将该字符串作为命令的参数。但是,我以某种方式收到以下错误。我错过了什么?

This command was not invoked properly. The help for this command is
available below.

Usage: vagrant box remove <name>

Options:

    -f, --force                      Remove without confirmation.
        --provider PROVIDER          The specific provider type for     the box to remove
        --box-version VERSION        The specific version of the box     to remove
        --all                        Remove all available versions     of the box
    -h, --help                       Print this help

谢谢,

我认为 xargs 正在将更多框合并到一个命令中,因为这是默认行为。尝试使用 -n 开关强制每个命令一个参数:

$ vagrant box list | awk '{ print ; }' | xargs -n 1 vagrant box remove