Shell命令批量创建Mysql表

#!/bin/bash

str="CREATE TABLE T_Test ( id bigint(50) NOT NULL COMMENT '全局唯一ID',
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
modify_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED COMMENT='测试';"
mysql -A -hxxxx -P3306 -Dtable01 -utest -ptest -e"$str"
for((i=511; i<1024; i++))
do
    nu=`echo ${i}|awk '{printf("%04d\n",$0)}'`
    str="CREATE TABLE T_Test_$nu ( id bigint(50) NOT NULL COMMENT '全局唯一ID',
    create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    modify_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,PRIMARY KEY (id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED COMMENT='测试';"
    mysql -A -hxxxx -P3306 -Dtable01 -utest -ptest -e"$str"
done