#!/bin/bash set -eu src="$1" dst="$2" anchor='void tx_application_define(void *first_unused_memory){}' line=$(grep -n -F "$anchor" "$src" | head -n 1 | cut -d: -f1) if [ -z "$line" ]; then echo "failed to find tx_application_define anchor in kernel setup test source" >&2 exit 1 fi mkdir -p "$(dirname "$dst")" sed "${line}a\\ void test_interrupt_dispatch(void){}" "$src" > "$dst"