Skip to content

Instantly share code, notes, and snippets.

@m2ym
Last active December 10, 2015 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m2ym/4467511 to your computer and use it in GitHub Desktop.
Save m2ym/4467511 to your computer and use it in GitHub Desktop.
dpkg-readme helps you to quickly open README.Debian of given package
#!/bin/sh
: ${PAGER:=cat}
package="$1"
readme="$(dpkg-query -L "$package" 2> /dev/null | grep README.Debian | head -n 1)"
if [ -s "$readme" ]; then
case "$readme" in
*.gz) gunzip -qc "$readme" | $PAGER;;
*) $PAGER "$readme";;
esac
else
echo "$package: README.Debian not found" >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment