#!/bin/sh #--------------------------------------------------------------- # Project : Mandriva Linux # Module : rpm # File : filter.sh # Version : $Id$ # Author : Frederic Lepied # Created On : Tue May 13 15:45:17 2003 # Purpose : filter using grep and first argument the # command passed as the rest of the command line #--------------------------------------------------------------- GREP_ARG="$1" FILE_GREP_ARG="$2" PROG="$3" shift 3 GREP_PROG="cat" FILE_GREP_PROG="cat" # use ' ' to signify no arg as rpm filter empty strings from # command line :( [ "$GREP_ARG" = ' ' ] || GREP_PROG="grep -v $GREP_ARG" [ "$FILE_GREP_ARG" = ' ' ] || FILE_GREP_PROG="grep -v $FILE_GREP_ARG" $FILE_GREP_PROG | $PROG "$@" | $GREP_PROG exit 0 # filter.sh ends here