xref: /freebsd/bin/sh/tests/execution/path1.0 (revision a8089ea5aee578e08acab2438e82fc9a9ae50ed8)
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