#!/bin/bash cd /var/lib/mysql/mysql/ for i in $1*; do if [ ! -d $i ]; then continue; fi echo $i ... cd $i for j in *.MYD; do N=`basename $j .MYD` if [ "x$N" = "x*" ]; then continue; fi echo "repair table $N;" | mysql.login $i | \ grep -v -e ^Table -e OK$ done cd - done