bug-bash
[Top][All Lists]
Advanced

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

mod arithmetic result 0 gives error exit status


From: Duane Ellis
Subject: mod arithmetic result 0 gives error exit status
Date: Mon, 10 Oct 2005 17:00:19 -0400

VERSION:
        GNU bash, version 3.00.15(1)-release (i386-redhat-linux-gnu)
        {came with Red Hat EL-4}

Description:

        Valid math operations results give an ERROR exit status.

While this is a documented feature [4.2 of the info file] 

        If the last EXPRESSION evaluates to 0,
        `let' returns 1; otherwise 0 is returned.

grr grrr ... it was not expected, and bash treats it as an ERROR

        bash$ let A=1-1
        bash$ echo $?

Info file: "6.5 Shell Arithmetic" where available operators are
listed implies that the only "error" that can occur is division by 
zero. 

        "[snip] with no check for overflow, though division 
        by 0 is trapped and flagged as an error."

Implies otherwise.

Thanks.

Duane Ellis





reply via email to

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