Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function resetdb()
  2. {
  3. host="asdf"
  4. user="asdf"
  5. passwd="asdf"
  6. database=( "asdf" "asdf")
  7.  
  8. for db in "${database[@]}"; do
  9. read -r -d '' -a tables < <(mysql -u$user -p$passwd -h$host $db -B -s -e 'show tables');
  10. (IFS=,; echo "DROP TABLE ${tables[*]};") | mysql -v -u$user -p$passwd -h$host $db;
  11. mysql -u$user -p$passwd -h$host $db < ../../../database/$db.sql;
  12. mysql -u$user -p$passwd -h$host $db < ../../../database/demo.sql;
  13. done
  14. }
  15.  
  16.  
  17. ./update.sh: line 35: syntax error near unexpected token `;'
  18. ./update.sh: line 35: ` (IFS=,; echo "DROP TABLE ${tables[*]};") | mysql -v -u$user -p$passwd -h$host $db;'
  19. ./update.sh: line 36: ../../../database/.sql: No such file or directory
  20. mysql: option '-h' requires an argument
  21. ./update.sh: line 38: syntax error near unexpected token `done'
  22. ./update.sh: line 38: ` done'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement