#!/bin/sh case $# in 0) 1>&2 echo Usage: $0 files...; exit 1;; esac case $1 in -f*) idfile_arg=$1; shift;; esac errors= echo "idx ..." idx "$@" |sort -u >ID.idx echo "lid ..." lid $idfile_arg |sed -e 's/[ ].*//' |sort -u >ID.lid if cmp -s ID.idx ID.lid; then rm -f ID.idx ID.lid echo "Good. idx and lid agree." else 1>&2 echo "Oops! idx and lid disagree--look in ID.idx and ID.lid" errors=t fi idx_file=$$.idx fid_file=$$.fid for file do case x$file in x-*) scan_args="$scan_args $file" continue;; esac fid $idfile_arg $file >$fid_file idx $scan_args $file |sort -u >$idx_file if cmp -s $idx_file $fid_file; then echo "Good. idx and fid agree for $file" else 1>&2 echo "Oops! idx and fid disagree for $file" errors=t fi done rm -f $idx_file $fid_file case x$errors in xt) 1>&2 echo "mkid and friends are broken."; exit 1;; *) echo "mkid and friends are happy."; exit 0;; esac