[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash 'let' can give error

From: Chet Ramey
Subject: Re: bash 'let' can give error
Date: Fri, 10 Dec 2010 15:19:04 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20101027 Thunderbird/3.1.6

On 12/10/10 12:17 PM, Marc Herbert wrote:
> Le 10/12/2010 16:05, Andreas Schwab a écrit :
>>> This is a design mistake: it trades a few characters for a lot of confusion.
>> You can always choose to ignore the exit status.  The converse is not
>> true.
> Agreed, but that does not imply any command should try to be creative
> and throw random status values in obscure corner cases just to show off.

That's a little harsh, don't you think?  The behavior of let and its
sibling `((', and expr before it, is designed to make this kind of thing
very easy:

while (( x )); do something with x and decrement it ; done

The exit status rules are very simple and well-defined.  If you don't
like the way let works, there's nothing stopping you from using `:'
or straight variable assignment together with $((...)).

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]