[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: list package version if installed (scriptable)



On Thu, Jan 07, 2021 at 08:12:52AM -0500, Jim Popovitch wrote:
> What is a script'able way to list a pkg version (or nothing if it is not
> installed)?
> 
> +1 for POSIX compatibility.

unicorn:~$ dpkg-query --show --showformat '${Version}\n' bash
5.0-4
unicorn:~$ dpkg-query --show --showformat '${Version}\n' gnome-core
dpkg-query: no packages found matching gnome-core
unicorn:~$ dpkg-query --show --showformat '${Version}\n' gnome-core 2>/dev/null
unicorn:~$ 


Reply to: