4 ms·
Bash exit code 0 is truthy, but that's not how the if statement works: if ((0)); then echo 0=true; else echo 0=false; fi if ((1)); then echo 1=true; else echo
by gshubert17 8y ago
Bash exit code 0 is truthy, but that's not how the if statement works:
if ((0)); then echo 0=true; else echo 0=false; fi
if ((1)); then echo 1=true; else echo 1=false; fi
# output
0=false
1=true
To work as expected, the if statements should be rewritten as
if ((i % 3 == 0 && i % 5 == 0)); then echo FizzBuzz
and so on.