The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: George Michaelson <ggm@algebras.org>
To: Richard Salz <rich.salz@gmail.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] sh and goto
Date: Wed, 16 Dec 2020 14:41:46 +1000	[thread overview]
Message-ID: <CAKr6gn1gBXtDNjfciVKJ_xO9Bos=O2aJubL2jSx7__XvS4uZKg@mail.gmail.com> (raw)
In-Reply-To: <CAFH29tpKsEr1-X_Xi75=oUr_6RdJUjbxyR3=Dn447g0LtL9k4A@mail.gmail.com>

Great solution. Not entirely "side effect free.."

On Wed, Dec 16, 2020 at 2:30 PM Richard Salz <rich.salz@gmail.com> wrote:
>
>
>> 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"
>

  reply	other threads:[~2020-12-16  4:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 16:02 srbourne
2020-12-15 19:44 ` Ken Thompson
2020-12-15 23:27   ` George Michaelson
2020-12-16  4:30     ` Richard Salz
2020-12-16  4:41       ` George Michaelson [this message]
2020-12-16  4:01 M Douglas McIlroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKr6gn1gBXtDNjfciVKJ_xO9Bos=O2aJubL2jSx7__XvS4uZKg@mail.gmail.com' \
    --to=ggm@algebras.org \
    --cc=rich.salz@gmail.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).