Skip to content

Instantly share code, notes, and snippets.

@fujii
Created August 7, 2015 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujii/edf595aa46f8f83261e8 to your computer and use it in GitHub Desktop.
Save fujii/edf595aa46f8f83261e8 to your computer and use it in GitHub Desktop.
#! /bin/bash
opt=()
while test $# -gt 0 -a "${1:0:1}" = -; do
opt=("${opt[@]}" "$1")
shift
done
if test $# -lt 3; then
echo Usage: $0 [diff options] command [command options] file-a file-b
exit 1
fi
cmd=${@:1:$(($#-2))}
shift $(($#-2))
exec diff ${opt[@]} --label "$1" --label "$2" <(${cmd[@]} "$1") <(${cmd[@]} "$2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment