#!/usr/bin/env bash
set -e

timeout 10 bash -c '
  until [ $(grep -c "pattern" file.txt) -gt 0 ]; do
    echo "pattern not found, sleeping for 2 secs..."
    sleep 2
  done
'
echo "pattern found! Exiting"
