#!/bin/bash cat "$1" | while read x do if [ "${x:0:4}" = 'cat ' ] then cat "${x:4}" || exit $? else echo "$x" fi done