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

Re: Capturing *all* the output (both stdout and stderr) from the apt-cache command.



Hi,

[mail reordered and cut: full-quote top-posting is frowned upon on
mailinglists usually]

On Thu, May 07, 2015 at 09:22:54PM +1200, Ivan Kurnosov wrote:
> On 7 May 2015 at 21:18, David Kalnischkies <david@kalnischkies.de> wrote:
> > 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.
>
> at the moment all I need is to get if a package with the given name is in
> the index.

Something like:
apt-cache pkgnames apt | grep -q '^apt$'

Might work just as well for this usecase and might even be a bit faster.

Not ideal from an interface point of view either, but I guess if you
want a nicer interface you are probably better of with python-apt or
your own c++ libapt user anyway.

[The relatively new 'apt list' will be one day useable for this, but it
 isn't really finished just yet and 'apt' shouldn't be used in scripts]

Best regards

David Kalnischkies

Attachment: signature.asc
Description: Digital signature


Reply to: