#!/bin/bash # Fix all test files with the local output=$ issue fix_test_file() { local file="$1" echo "Fixing $file..." # Use perl to fix the pattern perl -i -pe 's/(\s+)local output=\$\(([^)]+)\)(\s*2>&1)?\s*$/\1local output\n\1output=\$(\2\3)\n/g' "$file" echo "Fixed $file" } # Fix all test files fix_test_file "/data/emu/rom-groomer/tests/test-organizers.sh" fix_test_file "/data/emu/rom-groomer/tests/test-error-handling.sh" echo "All test files fixed!"