2 # When invoked with a relative path name as an argument, redo-whichdo
3 # must output non-existent dofiles in the parent directory and the
4 # same directory until it outputs one that exists.
10 dofiles="default.do default.c.do default.b.c.do a/default.do a/default.c.do a/default.b.c.do a/a.b.c.do"
12 for dofile in ${dofiles}; do
13 if test -e "${dofile}"; then
18 for dofile in ${dofiles}; do
19 >"${dofile}" cat <<EOF
28 whichdo_dofiles_nonexistent=$(
29 printf '%s\n' "${whichdo_dofiles}" \
30 |sed '$d' # BusyBox v.1.19.3 has no “head -n-1”
32 for whichdo_dofile_nonexistent in ${whichdo_dofiles_nonexistent}; do
33 if test -e "${whichdo_dofile_nonexistent}"; then
34 >&2 printf 'redo-whichdo prints %s as nonexistent dofile, but it exists.\n' \
35 "${whichdo_dofile_nonexistent}"
40 whichdo_dofile_existent=$(
41 printf '%s\n' "${whichdo_dofiles}" \
44 if ! test -e "${whichdo_dofile_existent}"; then
45 >&2 printf 'redo-whichdo prints %s as existent dofile, but it does not exist.\n' \
46 "${whichdo_dofile_existent}"