title: MySQL password input in bash script
body: <p>I have a bash script that needs to perform a couple actions in MySQL.  So far I have something like this:</p>
  
  <pre><code>#!/bin/sh
  read -p "Enter your MySQL username: " $sqluname
  read -sp "Enter your MySQL password (ENTER for none): " $sqlpasswd
  /usr/bin/mysql -u $sqluname -p $sqlpasswd &lt;&lt; eof
  *some SQL stuff*
  eof
  </code></pre>
  
  <p>This works well until it's used with a MySQL username that has a blank password.  The user hits ENTER at my password prompt, but then they receive another prompt to "Enter your password" again from MySQL.</p>
  
  <p>How can I avoid this second password prompt and make the script deal with both blank and non-blank passwords?</p>