Don't use -eq.  This causes:

[: False: bad number

If the data is not written correctly to database.