#!/bin/bash # chain.sh — compile a list of workfiles, fresh M2 boot per file. # Usage: chain.sh [file2 ...] # Prints last lines of each compile for inspection. DRV="$1"; shift for f in "$@"; do cat > /tmp/m2one_$$.txt < SEND M2\r EXPECT ork file SLEEP 2 SEND C EXPECT Workfile name SEND $f\r SLEEP 20 EOF echo "############ $f" python3 tools/m2drive.py "$DRV" /tmp/m2one_$$.txt 2>&1 | python3 -c " import sys,re out = sys.stdin.read() clean = re.sub(r'\x1b\[[0-9;?]*[a-zA-Z]|\x1b[()][AB0]', '', out) i = clean.find('Workfile name:') seg = clean[i:i+700] if i>=0 else clean[-400:] print(repr(seg))" done rm -f /tmp/m2one_$$.txt