[u-u] wow, post-tested loops in sh

Dan Astoorian djast at ecf.utoronto.ca
Mon Jul 4 11:50:11 EDT 2016

On Mon, 04 Jul 2016 10:25:24 EDT, "D. Hugh Redelmeier" writes:
> | From: Alan J Rosenthal <flaps at 56789.ca>
> | All this follows from the syntax of the 'while' statement, but still, wow.
> There's another lesson to take from this.  The understanding of the shell 
> that you had formed (and almost everyone else has too) is different from 
> the real thing.  That suggests that the real thing is wrong -- badly 
> designed for humans.

So, a language is wrong if it's possible to write things in it that can
be misunderstood or surprising?  Is C wrong because Duff's Device is

I think the only moderately surprising aspect is the fact that the
commands in the while condition's list can be separated by ";" (or, far
more perversely, "&"), as opposed to "&&" or "||"; I don't think that
many people would argue that:

    while pgrep "myprocess" >/dev/null && test $i -lt 5
	: # ...

should be syntactically invalid.

For a program from 1977, I think it's done okay for itself.

Dan Astoorian, Systems Administrator
Engineering Computing Facility
University of Toronto

More information about the u-u mailing list