summaryrefslogtreecommitdiff
path: root/pdiff.in
blob: 0483d2ca755f7e8d3bbe409288076a1c55a8d4b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

# part of even-more-utils, version #VERSION#

# 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}"
)