#!/bin/zsh
: ${delim:=---}
cmd=$1
inputs=( "$(mktemp)" )
while IFS= read line; do
	if [[ $line == $delim ]]; then
		inputs+=( "$(mktemp)" )
	else
		printf '%s\n' $line >>$inputs[-1]
	fi
done

for n in $(seq 1 $#inputs); do
	cmd=${cmd//@${n}@/${(qqq)inputs[$n]}}
done

eval $cmd
ret=$?

rm $inputs

exit $ret