3

Is it possible to make aptitude show the available/installed version of a package in an output of aptitude search mypackage?

I know that I can show the version via aptitude show mypackage, but I want it it to appear also in the output of an aptitude search.

student
  • 2,312

1 Answers1

3

This might work for you. Put this in a script file named apt-version.sh and make it executable.

#!/bin/bash
TERMS=$@
for name in $(apt-cache search "$TERMS" | sed 's/ .*//'); do
    echo "$name "
    apt-cache show $name | grep -i -e "description-en" -e "version" | sed 's/^/    /'
done

A test. Put your search terms after the name when you run it.

$ ./apt-version.sh  mesa-util
mesa-utils 
    Version: 8.0.1+git20110129+d8f7d6b-0ubuntu2
    Description-en: Miscellaneous Mesa GL utilities
mesa-utils-extra 
    Version: 8.0.1+git20110129+d8f7d6b-0ubuntu2
    Description-en: Miscellaneous Mesa utilies (opengles, egl)
Sepero
  • 4,557
  • Thanks, but it is not yet exactly what I want: I want just add the version to the usual aptitude search output (where also a very short description of the package is included) – student Jul 06 '12 at 20:09
  • I edited it so that it prints out the package description too. – Sepero Jul 07 '12 at 06:12