Skip to content

Instantly share code, notes, and snippets.

@toddlers
Created May 6, 2013 12:39
Show Gist options
  • Save toddlers/5524854 to your computer and use it in GitHub Desktop.
Save toddlers/5524854 to your computer and use it in GitHub Desktop.
remote_diff: grab a path from 2 websites and diff them a naive implementation, diffs the md5's if the files are not text
#!/bin/bash
path1=`echo $1 | awk -F, '{print $1}'`/$2
path2=`echo $1 | awk -F, '{print $2}'`/$2
if `curl -Ss $path1 | file - | grep text`; then
diff <(curl -Ss $path1) <(curl -Ss $path2)
else
diff <(curl -Ss $path1 | md5) <(curl -Ss $path2 | md5)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment