I want to check if java-11-headless is installed. java-11-headless is a virtual package and it is provided e.g. by java-11-openjdk-headless.x86_64 package. I do not care what exactly package provides java-11-headless I only want to check if java-11-headless is installed.
I googled my issue and all answers concern checking certain package (e.g. java-11-openjdk-headless.x86_64) , not virtual package (java-11-headless).
As you can see below java-11-openjdk-headless.x86_64 is isnalled:
[root@21b70cb5fc59 /]# rpm -q java-11-openjdk-headless.x86_64
java-11-openjdk-headless-11.0.16.1.1-1.el7_9.x86_64
[root@21b70cb5fc59 /]# echo $?
0
[root@21b70cb5fc59 /]# yum list installed java-11-openjdk-headless.x86_64
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: artfiles.org
* extras: centos.bio.lmu.de
* updates: centos.intergenia.de
Installed Packages
java-11-openjdk-headless.x86_64
Unfortunately I do not know how to check if java-11-headless is installed.
[root@21b70cb5fc59 /]# rpm -q java-11-headless
package java-11-headless is not installed
[root@21b70cb5fc59 /]# echo $?
1
[root@21b70cb5fc59 /]# yum list installed java-11-headless
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: artfiles.org
* extras: centos.bio.lmu.de
* updates: centos.intergenia.de
Error: No matching Packages to list
[root@21b70cb5fc59 /]# echo $?
1