xref: /freebsd/bin/sh/tests/execution/shellproc7.0 (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1# Non-POSIX trickery that is widely supported,
2# used by https://justine.lol/ape.html
3
4T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
5trap 'rm -rf "${T}"' 0
6printf "MZqFpD='\n\0'\n#'\"\necho this is a test\n" >"$T/testshellproc"
7chmod 755 "$T/testshellproc"
8PATH=$T:$PATH
9[ "`testshellproc`" = "this is a test" ]
10