1 2failures=0 3 4check() { 5 if ! eval "[ $* ]"; then 6 echo "Failed: $*" 7 : $((failures += 1)) 8 fi 9} 10 11f() { 12 cat <<EOF && echo `echo bar` 13foo 14EOF 15} 16check '"`f`" = "foo 17bar"' 18 19f() { 20 cat <<EOF && echo $(echo bar) 21foo 22EOF 23} 24check '"$(f)" = "foo 25bar"' 26 27f() { 28 echo `echo bar` && cat <<EOF 29foo 30EOF 31} 32check '"`f`" = "bar 33foo"' 34 35f() { 36 echo $(echo bar) && cat <<EOF 37foo 38EOF 39} 40check '"$(f)" = "bar 41foo"' 42 43exit $((failures != 0)) 44