zypper remove 期间是否匹配通配符?

zypper remove 期间是否匹配通配符?

我正在尝试从 openSUSE 中删除旧内核。openSUSE 版本是 Tumbleweed (20191128),旧内核是 5.1.16。

Zypper 的手册页是这里。看起来 Zypper 支持通配符(如果我正确解析了手册页),但我没有得到正确的语法。我不确定如何告诉包管理器在删除期间匹配通配符。

我如何告诉 Zypper 删除匹配的软件包*5.1.16*


> ls /boot/
boot.readme                  sysctl.conf-5.1.16-1-default
config-5.1.16-1-default      sysctl.conf-5.3.12-1-default
config-5.3.12-1-default      System.map-5.1.16-1-default
grub2                        System.map-5.3.12-1-default
initrd                       vmlinux-5.1.16-1-default.gz
initrd-5.1.16-1-default      vmlinux-5.3.12-1-default.gz
initrd-5.3.12-1-default      vmlinuz
symvers-5.1.16-1-default.gz  vmlinuz-5.1.16-1-default
symvers-5.3.12-1-default.gz  vmlinuz-5.3.12-1-default

> sudo zypper remove *5.1.16*
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
'*5.1.16*' not found in package names. Trying capabilities.
No provider of '*5.1.16*' found.
Resolving package dependencies...

Nothing to do.

> sudo zypper remove '*5.1.16*'
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
'*5.1.16*' not found in package names. Trying capabilities.
No provider of '*5.1.16*' found.
Resolving package dependencies...

Nothing to do.

答案1

通配符仅适用于软件包名称,不适用于版本号:

要更新单个软件包,请指定一个或多个软件包名称。您可以在软件包名称中使用 * 和 ? 通配符来指定与模式匹配的多个软件包。

但是你可以这样做:

rpm -qa | grep "5.1.16" | xargs zypper rm

相关内容