xref: /freebsd/bin/sh/tests/builtins/dot2.0 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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