[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
inconsistent exit status of ((count++))
From: |
Andrew Benton |
Subject: |
inconsistent exit status of ((count++)) |
Date: |
Thu, 29 Jul 2010 18:33:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:2.0b3pre) Gecko/20100729 Shredder/3.2a1pre |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
uname output: Linux eccles 2.6.35-rc6 #1 SMP Fri Jul 23 11:52:29 BST
2010 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.1
Patch Level: 2
Release Status: release
Description:
[Detailed description of the problem, suggestion, or complaint.]
If I use set -e to make my scripts exit on error, the scripts fail if I
use something like:
count=0
((count++))
Repeat-By:
andy:~$ count=0
andy:~$ ((count++))
andy:~$ echo $?
1
andy:~$ ((count++))
andy:~$ echo $?
0
Fix:
This isn't a fix but I can work around this bug if I use ((++count))
andy:~$ count=0
andy:~$ ((++count))
andy:~$ echo $?
0
andy:~$
- inconsistent exit status of ((count++)),
Andrew Benton <=