[u-u] wow, post-tested loops in sh
jsellens at syonex.com
Mon Jul 4 14:53:21 EDT 2016
On Sun, 2016/07/03 10:12:28PM -0400, Alan J Rosenthal <flaps at 56789.ca> wrote:
| And now, my new learning gives me the following in sh as the post-tested-loop
| version (I'm not entirely sure how to indent it though):
| echo $i
| i=`expr $i + 1`
| test $i -lt 5
| do :
That is kind of entertaining. I trust you know about "break" of course?
For those that might not:
while true; do
i=`expr $i + 1`
test $i -lt 5 || break
I had wanted to give an example like
for i in `seq $1 4` ; do
but that's not quite the same as your stated problem.
Hope that's interesting for someone!
More information about the u-u