Re: [PATCH] Supplant the "while case ... break ;; esac" idiom
- From
Miles Bader <miles@gnu.org>
- Date
- Sep 24, 2007, 11:21 UTC
- Message-ID
- <87ps08s3zt.fsf@catnip.gol.com>
- In-Reply-To
- <Pine.LNX.4.64.0709241128460.28395@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 13 quoted lines
>> > $# != 0 would yield sth like (strcmp(sprintf("%d", argc), "0"))
>> > $# -ne 0 would yield sth like (argc != atoi("0")).
>>
>> Of course this holds only for shell where test/[ is a builtin, which
>> is the at least the case for zsh, bash, and dash (but not posh).
>
> The reason we used "case" is that this has always been a builtin (has to
> be, because it changes workflow).
>
> Therefore I am somewhat uneasy that the patch went in so easily,
> especially given a message that flies in the face of our endeavours to
> make git less dependent on any given shell (as long as it is not broken to
> begin with).The comment "... holds only for a shell where [ is a builtin" doesn't make any sense to me though: "-ne" is a standard operator even if "[" isn't a builtin. It's useful if you are testing numbers in potentially non-canonical form, e.g., with leading zeroes or something, and AFAIK is quite portable.
-Miles
-- Everywhere is walking distance if you have the time. -- Steven Wright