--- /dev/null
+#!/bin/sh
+#
+# usage:
+# ./quacks-ingredients-make-copy-gcodes Tests_L
+# Uses
+# quacks-ingredients-L$l,Tests_L.auto.stl
+# to make
+# quacks-ingredients-L$l,Tests_L.auto.gcode
+# and then edits them and copies them to the SD card as
+# PREPARED/Q$l.G
+
+set -e
+
+f=$1
+shift
+
+umount /media/sd >/dev/null 2>&1 ||:
+mount /media/sd
+
+lhs=quacks-ingredients-L
+
+gh () {
+ g=$lhs$l.auto.gcode
+ h=/media/sd/PREPARED/Q$l.G
+}
+
+for l in 1 2 3 4 5; do
+ gh
+ cura -s $lhs$l,$f.auto.stl -o $g
+ case $l in
+ 1|2|3|4)
+ perl -i~ -pe 's/^/;/ if m/^M140 S0\b.*\n/' $g
+ ;;
+ 5) ;;
+ *) echo >&2 "??? $l"; exit 1 ;;
+ esac
+
+ perl -i~ -ne '
+ $l =~ s/^/;/ if m/^M400/;
+ print $l or die $!;
+ $l = $_;
+ END { print $l or die $!; }
+ ' $g
+
+ cp $g $h
+done
+
+umount /media/sd
+mount /media/sd
+
+for l in 1 2 3 4 5; do
+ gh
+ cmp $g $h
+ ls -l $h
+done
+
+umount /media/sd