[SLUG] Debian installed package test

2004-10-06 Thread Gavin Carr
Debian-dudes,

Is there a cleaner way of testing whether a package is installed on
debian than something like:

  dpkg -l $PKG | grep -q ^ii

Cheers,
Gavin
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Debian installed package test

2004-10-24 Thread Peter Chubb
> "Gavin" == Gavin Carr <[EMAIL PROTECTED]> writes:

Gavin> Debian-dudes, Is there a cleaner way of testing whether a
Gavin> package is installed on debian than something like:

Gavin>   dpkg -l $PKG | grep -q ^ii

Dunno whether this is cleaner, but you can do:
  expr `dpkg-awk 'Package:^'"$PKG"'$' -- Status` ':' '.* installed$'

if you like...

Your `grep -q ^ii' BTW, is too restrictive -- if a package is marked
for update or removal, it's still installed -- only the second `i' is
important.

Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
The technical we do immediately,  the political takes *forever*
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html