From 1d1e425b07bbb7ae04f9c7db269c359ebcdab246 Mon Sep 17 00:00:00 2001 From: kaa Date: Sat, 10 Aug 2024 01:41:58 -0700 Subject: Public release. --- check.rc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 check.rc (limited to 'check.rc') diff --git a/check.rc b/check.rc new file mode 100755 index 0000000..099bce7 --- /dev/null +++ b/check.rc @@ -0,0 +1,22 @@ +#!/usr/local/plan9/bin/rc + +fn sum { + find . -type f | while (file = `{read}) { + if (test -f $"file ) { + sha256 $"file + } + } +} + +previous = '' +sum | sed -E -e 's/(.*) = (.*)/\2 \1/' -e 's/SHA256 .//' -e 's/.$//' | sort | \ + tee sum | while (line = `{read}) { +#cat sum | while (line = `{read}) { + sum = `{echo $line | sed -E -e 's/([^ ]*) (.*)/\1/'} + file = `{echo $line | sed -E -e 's/([^ ]*) (.*)/\2/'} + if (~ $sum $previous) { + echo $"file is a duplicate. + } + + previous = $sum +} -- cgit v1.2.3