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

Re: dpkg-query --show, invalid output when package is not found, and executed within a bash script.



On Fri, 15 Jun 2012 16:16:22 +0800
eugene qin <picocreator@gmail.com> wrote:

> The following shows an unexpected behaviour of the query output directly to
> the console screen, as oppose to what was intended in the bash script. The
> following 2 bash script examples, will probably explain the bug better.

$ dpkg-query --show theseAintTheDroidsYourLookingFor 2>&1
No packages found matching theseAintTheDroidsYourLookingFor.
$ dpkg-query --show theseAintTheDroidsYourLookingFor 2>/dev/null
$ dpkg-query --show theseAintTheDroidsYourLookingFor >file 2>&1
$ cat file
No packages found matching theseAintTheDroidsYourLookingFor.

The behaviour is correct - requested output goes to STDOUT, error
messages go to STDERR.

> In the second case, the variable is returned a blank

The variable is reading STDOUT.

>, while the "No package
> found" output goes directly to console screen.

... because you aren't capturing STDERR

> PS: Im sending this email, as I am unable to find the bug tracker for the
> package directly =x

http://bugs.debian.org/dpkg

-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/

Attachment: pgpPKESFDXYKi.pgp
Description: PGP signature


Reply to: