it returns errors once launched this bash script:
./mysql_optimize: line 10: read: ` ': not a valid identifier
./mysql_optimize: line 11: datalength: command not found
It looks to me that you’re using the wrong type of quotes in your SQL statement, whereever you keep it.
I would assume that since you’re comparing PERCENT with a number, the result of a division, that shouldn’t need of quotes there. Same with ROWCOUNT.
My only doubt is if $PERCENT is the same variable than PERCENT but I never done this type of stuff so I trust the code is OK.
Thanks, i think i just found the cause. There is a block of words after line "mysql -NBe “SHOW TABLE STATUS;” $database " one have to place these all on one line and remove slashes at the end of lines.