Update 2009/07/02: Although I wrote this script specifically for comparing files, I have found that it also saves a lot of typing for editing individual remote files, cutting 14 characters of syntactic sugar down to 5: bbs<Tab> and a Space.


I often need to reconcile (partially or completely) one or more files on two or more machines. I often to use BBEdit's excellent "Find Differences" to do this, but loading the files into BBEdit can be awkward. I still hope someday Bare Bones will add support for remote files to their bbdiff command, but I'm not holding my breath. Today I whipped up a shell script to make it more convenient:

#!/bin/sh
# bsftp: Edit multiple files from multiple hosts.
# Usage: bsftp "host1 host2 host3" "/etc/passwd /etc/shadow /etc/group"

for file in $2
 do
  for host in $1
   do
    bbedit sftp://root@$host/$file
   done
 done