#!/bin/bash if [ -z "$1" ]; then echo "usage: pacsearch [regex pattern]" echo "usage: pacsearch -h|--help" exit 0 fi if [ "$1" = "-h" -o "$1" = "--help" ]; then echo "usage: pacsearch [regex pattern]" echo " Like pacman -Ss [regex pattern] but installed packages are flagged with a *" echo "usage: pacsearch -h|--help" echo " Prints this message. No other options allowed" exit 0 fi firstchar=`echo "$1" | cut -c1` if [ $firstchar = "-" ]; then echo "Sorry, $1 is not a valid option!" echo "usage: pacsearch [regex pattern]" echo "usage: pacsearch -h|--help" exit 0 fi instpkg=`pacman -Qs $1 | egrep '^[^ ]' | sed 's|^local/||' | sed 's/ .\+$//'` syncdump=`mktemp` pacman -Ss $1 > $syncdump for pkg in $instpkg; do sed -i "s@^\(.\+/$pkg\) @\*\1 @" $syncdump done cat $syncdump