On 10/27/21 10:09 PM, Kerin Millar wrote:
This is to be expected. It works the same way as in other languages, such as C.
You should use the operator that reflects your intent.
Understood - thx for the explanation.
--
Toralf
On Wed, 27 Oct 2021 21:09:29 +0200
Toralf Förster wrote:
> Hi,
>
> expected:
> $ i=0; ((i = i + 1)); echo $?
> 0
>
> expected:
> $ i=0; ((++i)); echo $?
> 0
This makes use of a pre-increment operator. The evaluated number is 1.
>
> unexpected:
> $ i=0; ((i++)); echo $?
> 1
This makes use of
On Wed, Oct 27, 2021 at 09:09:29PM +0200, Toralf Förster wrote:
> unexpected:
> $ i=0; ((i++)); echo $?
> 1
https://mywiki.wooledge.org/BashFAQ/105
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)-
On 4/25/16 11:05 AM, Paulo Bardes wrote:
> I came about this weird behavior when comparing some test cases I wrote for a
> little shell I made for a CS class. Here's the thing:
>
> $ echo | echo $(sleep 5) # ^Z and then bg to reproduce
>
> If you just let it run everything is fine, but the weird
On Mon, Apr 25, 2016 at 12:05:34PM -0300, Paulo Bardes wrote:
> $ echo | echo $(sleep 5) # ^Z and then bg to reproduce
>
> If you just let it run everything is fine, but the weird thing is when you
> stop
> it and resume in background bash will quit when the command finishes.
Confirmed with bash
I came about this weird behavior when comparing some test cases I wrote for a
little shell I made for a CS class. Here's the thing:
$ echo | echo $(sleep 5) # ^Z and then bg to reproduce
If you just let it run everything is fine, but the weird thing is when you stop
it and resume in background ba