Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/bin/bash
  2. ########################################
  3. # MySQL | MariaDB autologin
  4. # License: GNU GPL v3+
  5. # Author: Valerio Bozzolan
  6. ########################################
  7.  
  8. file=/etc/mysql/debian.cnf
  9.  
  10. while [ -z "$user" ] && read ln; do
  11. [[ "$ln" =~ user\ *=\ (.*)$ ]]
  12. user="${BASH_REMATCH[1]}"
  13. done < $file
  14.  
  15. while [ -z "$pass" ] && read ln; do
  16. [[ "$ln" =~ password\ *=\ (.*)$ ]]
  17. pass="${BASH_REMATCH[1]}"
  18. done < $file
  19.  
  20. mysql --user="$user" --password="$pass" $@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement