1#!/bin/bash 2set -e 3 4query="$1" 5filepath="$2" 6grepOptions="$3" 7if [ "$query" == "" ]; then 8 echo "Usage: vgrep.sh <query> <log>" 9 echo "Uses grep to search for <query> in <log>, and inverts the return code" 10 echo "Additionally, if the query is not found, displays the bottom of the log file" 11 exit 2 12fi 13 14if grep $grepOptions "$1" "$filepath"; then 15 exit 1 16fi 17tail -n 40 "$filepath" 18exit 0 19