Advertisement
Guest User

Untitled

a guest
Sep 7th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "Host:"
  4. read db_host
  5.  
  6. echo "User:"
  7. read db_user
  8.  
  9. echo "Password:"
  10. read db_pwd
  11.  
  12. echo "Database:"
  13. read db_database
  14.  
  15. done_files=`cat done_files.txt`
  16.  
  17. for sql_file in *.sql; do
  18.  
  19. if echo $done_files | grep -q -w "$sql_file"; then
  20. echo "."
  21. else
  22. echo "$sql_file"
  23. mysql -h $db_host -u $db_user -p$db_pwd $db_database < $sql_file
  24. echo "$sql_file" >> done_files.txt
  25. fi
  26.  
  27. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement