xref: /freebsd/bin/sh/tests/builtins/dot1.0 (revision db33c6f3ae9d1231087710068ee4ea5398aacca7)
1
2failures=
3failure() {
4	echo "Error at line $1" >&2
5	failures=x$failures
6}
7
8T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit
9trap 'rm -rf $T' 0
10cd $T || exit 3
11unset x
12echo 'x=2' >testscript
13. ./testscript
14[ "$x" = 2 ] || failure $LINENO
15cd / || exit 3
16x=1
17PATH=$T:$PATH . testscript
18[ "$x" = 2 ] || failure $LINENO
19
20test -z "$failures"
21