#!/bin/bash for i in `ls $1/mysqldump*`; do db=`sed -n -e 3p $i | awk -F "Database: " {'print $2'}` mysql -e "create database \`$db\`" echo `mysql -u root "$db" < $i` echo "created $db and filled from $i file" done
#!/bin/bash for i in `ls $1/mysqldump*`; do db=`sed -n -e 3p $i | awk -F "Database: " {'print $2'}` mysql -e "create database \`$db\`" echo `mysql -u root "$db" < $i` echo "created $db and filled from $i file" done