1#!/bin/bash
2
3# usage: grepOrTail.sh <query> <filepath>
4# This script searches for the given query inside the given file
5# If the query is not found, then this script displays the bottom of the file and then fails
6
7query="$1"
8filepath="$2"
9
10if grep -C 10 "$query" "$filepath"; then
11  exit 0
12fi
13
14tail -n 40 "$filepath"
15exit 1
16