#!/bin/sh

# part of even-more-utils, version 0.4

# diff with pipes

if [ $# -lt 3 ]; then
  >&2 echo 'usage:'
  >&2 echo 'pdiff file1 file2 pipe_command [options to diff]'
  exit 1
fi

file_one="$1";
file_two="$2";
pipe_cmd="$3";
shift 3

diff "$@" <(
  cat "${file_one}" \
  | bash -c "${pipe_cmd}"
) <(
  cat "${file_two}" \
  | bash -c "${pipe_cmd}"
)
