date=`date -d "+0 day $1" +%Y%m%d`
enddate=`date -d "+1 day $2" +%Y%m%d`
echo "------------------------------"
echo "date=$date"
echo "enddate=$enddate"
echo "------------------------------"
while [[ $date < $enddate ]]
do
echo $date
date=`date -d "+1 day $date" +%Y%m%d`
mysql -uroot -p'bbtree_db_!@#$%' -S /tmp/mysql_3306.sock -P 3306 -e " use attendance; CREATE TABLE __test_zhs_attendance_record_$date (
id int(11) NOT NULL AUTO_INCREMENT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
"
done
转载于:https://www.cnblogs.com/DBA-tomzhao/p/8601925.html