#!/bin/sh # Plan 9 style diff diff=/usr/bin/diff while : do case "$1" in -*) opts="$opts$1 " shift ;; *) break ;; esac done case $# in 2) if [ -d "$1" -a -f "$2" ] then set "$1/`basename \"$2\"`" "$2" elif [ -f "$1" -a -d "$2" ] then set "$1" "$2/`basename \"$1\"`" fi exec $diff $opts "$1" "$2" ;; *) exec $diff $opts ${1+"$@"} ;; esac