xref: /freebsd/bin/sh/tests/execution/path1.0 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# Some builtins should not be overridable via PATH.
2
3set -e
4T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
5trap 'rm -rf ${T}' 0
6echo '#!/bin/sh
7echo bad' >"$T/cd"
8chmod 755 "$T/cd"
9cd /bin
10oPATH=$PATH
11PATH=$T:$PATH:%builtin
12cd /
13PATH=$oPATH
14[ "$(pwd)" = / ]
15