From fd6e4546b8af25b90124c40455ad19500ec3a709 Mon Sep 17 00:00:00 2001 From: Yasmine Aldana Date: Sat, 10 Aug 2024 02:09:40 -0700 Subject: At a lack for disk space, I'm abusing a family member's 2017 mac. --- check.rc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'check.rc') diff --git a/check.rc b/check.rc index 099bce7..cdfdc64 100755 --- a/check.rc +++ b/check.rc @@ -1,21 +1,25 @@ -#!/usr/local/plan9/bin/rc +#!/usr/bin/env rc + +fn read { + $HOME/9/plan9port-master/bin/read +} fn sum { - find . -type f | while (file = `{read}) { - if (test -f $"file ) { - sha256 $"file + find $1 -type f | while (f = `{read}) { + if (test -f $"f) { + shasum -a 256 $"f } } } +dir='b' 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/'} +sum $dir | sort | tee sum | while (line = `{read}) { + sum = `{echo $line | sed -e 's/ .*//'} if (~ $sum $previous) { - echo $"file is a duplicate. + file = `{echo $line | sed -e 's/[^ ]*//'} + echo $"file } previous = $sum -- cgit v1.2.3