#!/bin/bash # # lspkg # feedback: rhatto at riseup.net | gpl # # todo: # # -r, --remove: remove matching packages # -d, --description: show matching packages' descriptions # -s, --search: search a file under the matching packages # -p, --print: print the contents of a package file # function usage { echo usage: $0 [-v|-d|-s|-p expression] exit 1 } if [[ "$1" == "-v" ]]; then if [[ ! -z "$2" ]]; then less $(ls /var/log/packages/$2*) else usage fi elif [[ $1 = -p ]]; then if [ -f $2 ]; then tar ztvf $2 fi else ls /var/log/packages/$1* fi