blob: 0ecea909ed5bdfe64a7420c219544b7f941b2ef7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/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
|