Readme reader like man

documentation

man is the quick interface to online reference manuals. These are usually stored in /usr/share/man/manN/blah.gz, or similar. Most debian packages also come with a README.debian, which is stored in /usr/share/doc/blah/README.debian. Is there an automated reader for these files, that finds the appropriate README.debian, and opens it?

Best Answer

You can create a simple shell function and place it in your .bashrc:

readme() {
  if [ -e /usr/share/doc/"$1"/README.Debian ]; then
    "$PAGER" /usr/share/doc/"$1"/README.Debian
  else
    echo "No README for $1"
  fi
}

Use:

$ readme vlc

$Id: README.Debian 1436 2008-08-31 23:06:34Z xtophe-guest $

Notes for anyone wanting to build Debian packages of VLC.

 - Default configuration is supposed to be latest unstable.

 - VLC does not link with libdvdcss by default, thus it will not depend
   on the libdvdcss packages. However it will use libdvdread that can
   optionally open libdvdcss if found. To build packages that link directly
   against libdvdcss, remove the --without-dvdcss flag in debian/rules.

$ readme foobar

No README for foobar

You can smarten it up a little when you look for other README files (like the compressed ones which are often present) if the Debian file does not exist. Or collect all README files and offer a choice from which the user can select which one to display.

Related Question