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