[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ill positioned 'until' keyword
From: |
Andreas Schwab |
Subject: |
Re: Ill positioned 'until' keyword |
Date: |
Thu, 15 Dec 2011 10:44:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Bob Proulx <bob@proulx.com> writes:
> Peng Yu wrote:
>> I looks a little wired why 'until' is the way it is now.
>> ...
>> until test-commands; do consequent-commands; done
>> while ! test-commands; do consequent-commands; done
>
> In the original Bourne shell there is no '!' operator. The 'until'
> was a way to negate the expression without using a '!' which didn't
> exist in that shell. An 'if' could operate using the 'else' clause.
> But there wasn't any other way to do it in a while loop.
You could always do
while test-commands; test $? -ne 0; do ...; done
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."