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 ))
echo $? # Returns 1. Expected because it should be
# the same as (( ss != 0 )) No?
ss=1
(( ss ))
echo $? # Also says 1. Should this be 0 because it should be the
# success result same as (( ss != 0 ))
But if I use an operator...
ss=0
(( ! ss )) # Says 0.
ss=1
(( ! ss )) # Says 1.
So it seems to me that if I do not use the logical not operator, then
the arithmetic test is doing a test to see if the string value of ss
is not null (or something like that). Is this a bug? A feature? Or am
I doing it wrong?
TIA