From 444c18bbe3c3c297a602861f70101221ffde46d1 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 3 Apr 2016 00:49:52 +0200 Subject: [PATCH 5/7] query.sh: Use grep properly --- query.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/query.sh b/query.sh index a97aaec..83c5b51 100755 --- a/query.sh +++ b/query.sh @@ -13,10 +13,11 @@ TMPFILE=$IRCPATH/queries.tmp echo "searching new query data" for i in $(find $IRCPATH -newer $TMPFILE -name 'out') do - grep -v '\-!\-' $i > /dev/null 2>&1 # if file doesnt just contain server stuff + # if file doesnt just contain server stuff + grep -q -v '\-!\-' $i if [ $? -ne 1 ]; then # strip server, nickserv and channel out files - echo $i | egrep -v -i "nickserv|#|$IRCPATH/(irc\.freenode\.net|irc\.oftc\.net)/out" > /dev/null 2>&1 + echo "$i" | grep -q -v -i -E "nickserv|#|$IRCPATH/(irc\.freenode\.net|irc\.oftc\.net)/out" if [ $? -ne 1 ]; then printf "new data in: %s\n========================================================\n" "$i" tail -5 $i -- 2.8.0