[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unexpected exit code for integer operation
From: |
Toralf Förster |
Subject: |
unexpected exit code for integer operation |
Date: |
Wed, 27 Oct 2021 21:09:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
Hi,
expected:
$ i=0; ((i = i + 1)); echo $?
0
expected:
$ i=0; ((++i)); echo $?
0
unexpected:
$ i=0; ((i++)); echo $?
1
i is always set to 0, the result is always non-zero, but the return code
differs.
More info:
a stable hardened Gentoo Linux:
$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Greetings from Hamburg--
Toralf
- unexpected exit code for integer operation,
Toralf Förster <=