Programa para importar/exportar datos en bds MySQL (matias colli)

Hice este script que me parecio muy útil (Matias Colli):

#!/bin/bash
#
# Program to backup an entire database or specific table
# written by Matias Colli
#
mysql_command="/usr/bin/mysql"
mysqldump_command="/usr/bin/mysqldump"
mysqlcheck="mysqlcheck"
user="root"
password=""
db=""
tables=""
read -t 60 -p "Database: " db
if [ -s $db ]; then
    echo "You must specify database."
    exit 0
fi
read -t 60 -p "User ($user): " newuser
if [ ! -s $newuser ]; then user=$newuser ; fi
read -t 60 -p "Password ($password): " password
if [ ! -s $password ]; then password=$newpassword ; fi
read -t 60 -p "Tables (separates with space): " tables
echo -e -n "Select beetween \n\t1 - Export (by default)\n\t2 - Import\nChoice: "
read $action
if [ -s $action ]; then action=1 ; fi
read -t 60 -p "Export data too? (Y/n): " nodata
if [ "$nodata" = "n" ]; then
    nodata="--no-data"
    echo "Only will export the tables structure."
else
    nodata=""
fi
if [ $action -eq 1 ]; then
    for table in $tables; do
        echo -n "\nExporting table $table of $db...."
        $mysqldump_command $nodata -u$user -p$password $db $table > $db-$table.sql
        echo "[done]"
    done
else
    if [ $action -eq 2 ]; then
        for table in $table; do
            echo -n "\nImporting table $table of $db..."
           $mysql_command $nodata -u$user -p$password $db < $db-$table.sql

           echo "[done]"

       done
    else
        echo -e "\nOnly must choise beetween 1 or 2. Bye."
        exit 0
    fi
fi
read -t 60 -p "Do you want to repair $db? (y/N): " repair
if [ "$repair" = "y" ] ; then
    $mysqlcheck --auto-repair --databases $db -u$user -p$password
fi