Yup!: Re: Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-09-07 Thread L A Walsh
On 8/28/2020 1:00 AM, Gabriel Winkler wrot > # Causes error > test=0 > ((test++)) > echo $? > 1 > echo $test > 1 > "((...))" is the "test form" for an integer expression. That means it will return true if the value of the interior, "...", of "((...))" is non-zero and return false if ((... ==

Re: Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-08-28 Thread Greg Wooledge
On Fri, Aug 28, 2020 at 08:00:30AM +, Gabriel Winkler wrote: > # Causes error > test=0 > ((test++)) > echo $? > 1 > echo $test > 1 https://mywiki.wooledge.org/BashFAQ/105 Exercise 1. And 2. And the whole rest of the page.

Re: Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-08-28 Thread Ilkka Virta
On Fri, Aug 28, 2020 at 4:04 PM Gabriel Winkler wrote: > # Causes error > test=0 > ((test++)) > echo $? > 1 > It's not an error, just a falsy exit code. An error would probably give a message. But to elaborate on the earlier answers, the value of the post-increment expression var++ is the _old_

Re: Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-08-28 Thread Chris Elvidge
On 28/08/2020 09:00 am, Gabriel Winkler wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.4 -L/home/abuild/rpmbuild/BUILD/bash-4.4/../readline-7.0 Compilation CFLAGS: -DPROGRAM='bash'

Re: Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-08-28 Thread
On 28/08/2020 09:00, Gabriel Winkler wrote: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.4 -L/home/abuild/rpmbuild/BUILD/bash-4.4/../readline-7.0 Compilation CFLAGS: -DPROGRAM='bash'

Incrementing variable=0 with arithmetic expansion causes Return code = 1

2020-08-28 Thread Gabriel Winkler
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.4 -L/home/abuild/rpmbuild/BUILD/bash-4.4/../readline-7.0 Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu'