1

In a case where I write a query for dpkg-query to list me some package, I would like it to return me the package name if it finds something. If it doesn't find anything, I don't want it to output: no package found matching {package-name} I would like it to output nothing at all.

The reason for this is because my query is in a script and if it returns that my script breaks. How can I achieve this?

4

You can redirect dpkg-query's stderr to /dev/null to silence the error message, as in dpkg-query --list <package> 2>/dev/null.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.