Skip to content

Instantly share code, notes, and snippets.

@wrzlbrmft
Created March 29, 2016 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrzlbrmft/fe981ee496db7de8177a to your computer and use it in GitHub Desktop.
Save wrzlbrmft/fe981ee496db7de8177a to your computer and use it in GitHub Desktop.
Check a URL for a string and send an e-mail if found.
#!/bin/sh
CHECK_URL="https://store.google.com/"
CHECK_STRING="Nexus 5"
MAIL_TO="mail@example.org"
MAIL_SUBJECT="$CHECK_STRING"
MAIL_BODY="$CHECK_URL"
COUNT="$(curl -Ls "$CHECK_URL" | grep -c "$CHECK_STRING")"
if [ "$COUNT" != "0" ]; then
printf "$MAIL_BODY\n" | mail -s "$MAIL_SUBJECT" "$MAIL_TO"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment