2015-09-23
#delete_table_data.sh
#批量删除mysql库中表数据 #!/bin/bash ### AUTHOR: Leo ### DATE: 2015/09/23 ### REV: 1.0 echo -e "Input the dbname you want to use: \c" read db mysql -uroot -ppro#pateo -e "use $db;show tables;"|grep -v Tables>tb_in_$db.txt; for tb in `cat tb_in_$db.txt` do echo $tb; mysql -uroot -ppro#pateo -e "use $db;delete from $tb;select * from $tb;" echo '---------------------------------------'; done rm -rf tb_in_$db.txt;