1208629Sjilles# $FreeBSD: releng/11.0/bin/sh/tests/builtins/return4.0 208629 2010-05-28 22:08:34Z jilles $ 2208629Sjilles 3208629Sjillesfailures= 4208629Sjillesfailure() { 5208629Sjilles echo "Error at line $1" >&2 6208629Sjilles failures=x$failures 7208629Sjilles} 8208629Sjilles 9208629SjillesT=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit 10208629Sjillestrap 'rm -rf $T' 0 11208629Sjillescd $T || exit 3 12208629Sjillesecho 'return 42; exit 4' >testscript 13208629Sjilles. ./testscript 14208629Sjilles[ "$?" = 42 ] || failure $LINENO 15208629Sjilles 16208629Sjillestest -z "$failures" 17