Guest User

Untitled

a guest
Aug 13th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3.  
  4. DB_USER="???"
  5. DB_PASS="???"
  6. DB_HOST="???"
  7.  
  8. if [ ! "$DB_USER" ] || [ ! "$DB_PASS" ] || [ ! "$DB_HOST" ]; then
  9. echo "You need to set DB_USER, DB_PASS and DB_HOST environmental variables."
  10. exit 1
  11. fi
  12.  
  13.  
  14. # escape new lines and backticks
  15. mysql -u${DB_USER} \
  16. -p${DB_PASS} \
  17. -h${DB_HOST} \
  18. my_db_name -e "SELECT * \
  19. FROM \`foo\`.\`bar\` fb";
Add Comment
Please, Sign In to add comment