#!/bin/sh # Accepts filenames either on the command line, or if the command line # is empty, as a null-separated list of filenames on stdin. MD5S="`mktemp`" if (( $# > 0 ));then md5sum "$@" else xargs -0 md5sum fi > "$MD5S" < "$MD5S" awk '{ print $1 }' | sort | uniq -d | fgrep -f - "$MD5S" | sort rm "$MD5S"