[TUHS] sh and goto

Richard Salz rich.salz at gmail.com
Wed Dec 16 14:30:43 AEST 2020


> trap is a setjmp/longjmp type outcome. You pop up in a call you didn't
> exactly "plan" for (well you did: you wrote it. But you don't know the
> entry state which led you there, unlike normal program flow) -well, it
> is.. because you get there.


I once won a Usenix contest for using /bin/sh to test your reflexes.

trap "ls | wc ; exit 0" 0 1 2 3 15
ls * | wc -l
echo "Type ^C; see how close you can make your number match"
rm -rf * | wc -l
kill -1 $$ # For those without "trap 0"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20201215/744dc555/attachment.htm>


More information about the TUHS mailing list