Skip to content

Instantly share code, notes, and snippets.

@starkers
Last active August 29, 2015 14:01
Show Gist options
  • Save starkers/32843075e5429d4fb370 to your computer and use it in GitHub Desktop.
Save starkers/32843075e5429d4fb370 to your computer and use it in GitHub Desktop.
Looping command doorman - I use this "doorman" to comapre output of two slightly different commands
#!/usr/bin/env bash
# This script loops forever and waits for a standard STDIN for each loop.
#
# When you hit [RETURN] it pipes you're input into the command you launched the script with
#
# For example.. If I want to compare public DNS records (on 4.2.2.3 for example) with the
# records on my own DNS server.. EG: 1.2.3.4 I would split a terminator it two and run:
# Terminal 1: doorman dig @4.2.2.3 +short
# Terminal 2: doorman dig @1.2.3.4 +short
#
# I then join the terminals into the same group...
# type in the records you want to test... EG: MX somesite.org
#
while true; do
read input
$@ $input
sleep 0.5
echo "[end: $?]"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment