bug-bash
[Top][All Lists]
Advanced

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

Re: bash 'let' can give error


From: Marc Herbert
Subject: Re: bash 'let' can give error
Date: Fri, 10 Dec 2010 15:49:35 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Thunderbird/3.1.6

> let intentionally returns status 1 if the value was 0; and status > 1 if
> there was an error.  Why?  So you can do loops such as:
> 
> countdown=10
> while let countdown--; do ... ; done
> 
>> Why does this happen? Is it 'by design'?
> 
> Yes.  The same as for 'expr' which is standardized by POSIX to have the
> same behavior.

This is a design mistake: it trades a few characters for a lot of confusion.





reply via email to

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