From 1a81e775d8f7c42dbb15a711d265fbb17458aafa Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 9 Jan 2017 14:11:43 +0100 Subject: [PATCH] Add rundiff script for testing radiff2 -u features --- sys/rundiff | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 sys/rundiff diff --git a/sys/rundiff b/sys/rundiff new file mode 100755 index 0000000000..38f9b9ffc0 --- /dev/null +++ b/sys/rundiff @@ -0,0 +1,36 @@ +#!/bin/sh +show_help() { + echo "Usage: rundiff [-u] [cmd] [file1] [file2]" + exit 1 +} + +UNIQ=0 +if [ "$1" = "-u" ]; then + UNIQ=1 + shift +fi + +cmd="" +arg="" +for a in $@ ; do + if [ -n "$B" ]; then + cmd="$cmd $B" + fi + B="$A" + A="$a" +done +if [ -z "$cmd" -o -z "$A" -o -z "$B" ]; then + show_help +fi + +if [ "$UNIQ" = 1 ]; then + eval $cmd $A | sort -u > .a + eval $cmd $B | sort -u > .b +else + eval $cmd $A > .a + eval $cmd $B > .b +fi +echo $cmd $A +echo $cmd $B +diff -ru .a .b +rm -f .a .b