ref: ab3a209ed97ea6d9e085a32bf806fd9395615ade
parent: de4b7657e0cc10e1c3b78b8b73423afdefcc590a
author: Alex Musolino <[email protected]>
date: Thu Nov 23 18:50:13 EST 2023
archive.rc: avoid dependency on tac(1)
--- a/sdrip/archive.rc
+++ b/sdrip/archive.rc
@@ -13,9 +13,14 @@
year=substr($1, 1, 4)
month=substr($1, 5, 2)
dirs[sprintf("%s/%s", year, month)] = 1
- printf "mv -n %s %s/img/%s/%s/%s\n", $0, ENVIRON["HOME"], year, month, $0
+ mvs[$0] = sprintf("%s/img/%s/%s/%s", ENVIRON["HOME"], year, month, $0)
}
END{
+ printf "flag e +\n"
for(d in dirs)
printf "mkdir -p %s/img/%s\n", ENVIRON["HOME"], d
-}' | tac | sh
+ for(k in mvs)
+ printf "mv %s %s\n", k, mvs[k]
+ printf "exit 0\n"
+ exit(0)
+}' | rc