Skip to content

Instantly share code, notes, and snippets.

@RPDiep
Created January 23, 2014 15:02
Show Gist options
  • Save RPDiep/8579957 to your computer and use it in GitHub Desktop.
Save RPDiep/8579957 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# A simple remote side-by-side diff
#
# Author: Rene Diepstraten <rene@renediepstraten.nl>
#
[[ $# -ne 2 ]] || [[ ! $1 =~ ":" ]] || [[ ! $2 =~ ":" ]] && { echo -e "\nUsage: $0 <host1>:<file> <host2>:<file>\n" >&2 ; exit 1; }
file1=${1##*:} ; host1=${1%%:*} ; file2=${2##*:} ; host2=${2%%:*}
sdiff -w $(tput cols) <(ssh ${host1} "cat ${file1}") <(ssh ${host2} "cat ${file2}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment