Re: Question about arithmetic logic.

2011-04-18 Thread Steven W. Orr
Sorry to bother. I have no idea why it works now and did not before. Obvious case of cockpit error. :-( On 4/18/2011 10:30 AM, Steven W. Orr wrote: I happen to be running GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) I create an integer variable and assign it either a 0 or a 1

Re: Question about arithmetic logic.

2011-04-18 Thread Greg Wooledge
On Mon, Apr 18, 2011 at 10:57:00AM -0400, Steven W. Orr wrote: > I get the same result as you when I do it your way. But if I add the > typeset, I still get the same result: > > 515 > unset ss; typeset -i ss=1; ((ss)); echo $? > 0 > 516 > unset ss; typeset -i ss=0; ((ss)); echo $? > 1 > > Intere

Re: Question about arithmetic logic.

2011-04-18 Thread Steven W. Orr
On 4/18/2011 10:40 AM, Greg Wooledge wrote: > On Mon, Apr 18, 2011 at 10:30:35AM -0400, Steven W. Orr wrote: >> ss=1 >> (( ss )) >> echo $?# Also says 1. Should this be 0 because it should be >> the >> # success result same as (( ss != 0 )) > > That's not what I ge

Re: Question about arithmetic logic.

2011-04-18 Thread Chet Ramey
On 4/18/11 10:30 AM, Steven W. Orr wrote: > I happen to be running > > GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) > > I create an integer variable and assign it either a 0 or a 1. The > arithmetic test always returns success regardless of value. For example: $ cat x20 unset ss

Re: Question about arithmetic logic.

2011-04-18 Thread Roman Rakus
On 04/18/2011 04:30 PM, Steven W. Orr wrote: I happen to be running GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu) I create an integer variable and assign it either a 0 or a 1. The arithmetic test always returns success regardless of value. For example: typeset -i ss=0 (( ss

Re: Question about arithmetic logic.

2011-04-18 Thread Greg Wooledge
On Mon, Apr 18, 2011 at 10:30:35AM -0400, Steven W. Orr wrote: > ss=1 > (( ss )) > echo $? # Also says 1. Should this be 0 because it should be > the > # success result same as (( ss != 0 )) That's not what I get: imadev:~$ unset ss; ss=0; ((ss)); echo $? 1 imadev:~