Last active
August 29, 2015 13:56
-
-
Save Aricg/8944883 to your computer and use it in GitHub Desktop.
/usr/local/bin/remote_diff
This file contains hidden or 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 | |
| usage () | |
| { | |
| cat << EOF | |
| $0: diff the output of a command on two diffrent servers | |
| Usage $0 user@host1 user@host2 "command" | |
| EOF | |
| exit 1 | |
| } | |
| if [[ -z "$@" ]]; then usage | |
| fi | |
| #Assume root I do this so that complete -W works. I like pressing tab rather than typing. | |
| if ! [[ "$1" == *@* ]]; then | |
| firsthost="root@"$1"" | |
| else | |
| firsthost="$1" | |
| fi | |
| if ! [[ "$2" == *@* ]]; then | |
| secondhost="root@"$2"" | |
| else | |
| secondhost="$2" | |
| fi | |
| #run remote diff | |
| diff <(ssh $firsthost ""$3"" ) <(ssh $secondhost ""$3"") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment