Created
March 13, 2013 22:30
-
-
Save beryllium/5157006 to your computer and use it in GitHub Desktop.
So you're trying to piece together what exploded between two remote servers. You want to be able to diff files on them, but you don't want to be doing a whole bunch of manual file transfers. Enter: remote-diff.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" -o -z "$2" -o -z "$3" ] | |
then | |
echo "Usage: remote-diff.sh [user@]host1 [user@]host2 path_to_file" | |
echo "" | |
echo "Note: If you need to specify a valid key or optional username for the host," | |
echo " you are encouraged to add the host configuration to your ~/.ssh/config file." | |
exit 1 | |
fi | |
#Inspired by a post on StackOverflow: http://serverfault.com/a/59147/114862 | |
colordiff <(ssh "$1" cat "$3") <(ssh "$2" cat "$3") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment