apt commands switch to quiet mode 1 if they encounter output to not beOn Thu, May 07, 2015 at 11:14:15AM +1200, Ivan Kurnosov wrote:
> I originally asked something similar here
> http://unix.stackexchange.com/q/201869/31347 but did not get the
> comprehensive answer.
>
> The complete question would be: how to capture everything apt-cache outputs?
>
> Example:
>
> apt-cache policy non_existing_package --- here we need to capture stderr
> apt-cache policy apt --- here we need to capture stdout
>
> So is there a generic command that could capture everything and pipe
> further so that the call like
>
> apt-cache policy ... | grep "something" --- was successful?
on a terminal like many other tools do to avoid sending output unfit for
programmatic consumption over a pipeline (like progress reports). The
answers on the page you referenced already hints you in the right
direction: All you need to do is explicitly setting the quiet mode to
override the default, ala:
apt-cache policy apt non_existing_package -q=0 2>&1 | less
Why this error isn't an error or at least a warning (both would be
visible in all quiet modes) I have to check, but it is usually the
'compatibility' hammer ruling here.
Btw: What are you trying to pull of? Policy output isn't really easy to
parse, so I wonder what you are trying to get from it.
Best regards
David Kalnischkies