#!/bin/sh -eu # When invoked with a relative filename for the file “default.do” as # an argument, redo-whichdo must not output that filename as possible # dofile. default_dofile="default.do" whichdo_dofiles=$( redo-whichdo "${default_dofile}" \ |tr '\0' '\n' ) for whichdo_dofile in ${whichdo_dofiles}; do case "${whichdo_dofile}" in "${PWD}/${default_dofile}") >&2 printf 'redo-whichdo outputs that this file is its own dofile: %s\n' \ "${whichdo_dofile}" exit 1 ;; esac done