Created
September 7, 2017 06:25
-
-
Save ivanrosolen/120fc34ceb65b0012370859b4830b45f to your computer and use it in GitHub Desktop.
Simple SH migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Host:" | |
read db_host | |
echo "User:" | |
read db_user | |
echo "Password:" | |
read db_pwd | |
echo "Database:" | |
read db_database | |
done_files=`cat done_files.txt` | |
for sql_file in *.sql; do | |
if echo $done_files | grep -q -w "$sql_file"; then | |
echo "." | |
else | |
echo "$sql_file" | |
mysql -h $db_host -u $db_user -p$db_pwd $db_database < $sql_file | |
echo "$sql_file" >> done_files.txt | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment