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