#!/bin/sh d="$(dirname "$1")/" cd "$d" # Re-arrange x, x.orig to x.orig, x i=0 while [ $((++i)) -le $# ]; do if [ $i -le $# ]; then if [ x"$1" = x"${2%.orig}" ]; then a=$1 b=$2 shift 2 : $((++i)) set -- "$@" "$b" "$a" else a=$1 shift set -- "$@" "$a" fi else a=$1 shift set -- "$@" "$a" fi done t=diff; for x in "$@"; do t=$t" ${x#$d}"; done exec xterm -title "$t" -e with-pager diff -u "$@"