[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
i++ cause bad return code when result is 1
From: |
David Lehmann |
Subject: |
i++ cause bad return code when result is 1 |
Date: |
Sun, 18 Aug 2013 16:57:43 -0400 |
% uname -a****
Linux dph1d1ods13 2.6.32-279.2.1.el6.x86_64 #1 SMP Thu Jul 5 21:08:58 EDT
2012 x86_64 x86_64 x86_64 GNU/Linux****
% bash --version****
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)****
The ((i++)) fails only when the result is 1. When the result is 0 or 2, it
does not fail. This is a problem when 'set -e'.
### i++ failes when āIā becomes one.
i=0
echo $?
0
% (( i++ ))
% echo $? ### this should not fail
1
% (( i++ ))
% echo $?
0
% (( i++ ))
% echo $?
0
- i++ cause bad return code when result is 1,
David Lehmann <=
Re: i++ cause bad return code when result is 1, Linda Walsh, 2013/08/19