[Accountant] possible bug in bash

Hi all,

I am trying to play with this and what I have found is really frustrating and I am interested if this is maybe a bug, if I use following code:

for (( i=0; i<enemyCount; i++ )); do
    read enemyId enemyX enemyY enemyLife
    if [[ $enemyLife > 0 ]]; then
        echo "Before shooting...$enemyId : $enemyLife" >&2 
        echo "SHOOT $enemyId"
        echo "After shooting...$enemyId : $enemyLife" >&2 
    fi
done

I would expect that with this code I will not shoot on target that is already dead, and by debug logs I should have not but anyway I am and currently I have tested this against 2 enemies (1 or 3 works fine)

Standard Error Stream:
After shooting…1 : 3
Enemy count is: 1
Before shooting…1 : 3
After shooting…1 : 3
Standard Output Stream:
SHOOT 0

Please could you help me to find where problem is as I have problem only with 2 enemies but 1 or 3 are just fine which makes me wonder if maybe there is bug here?

Thanks,

You can’t shoot several times during a same game turn. If you do so you’ll be out of sync with the input.