drop database via bash with dash in database-name
<p>I have a variable in a script with the list of folder names with dash in their names</p>

<pre><code>DBDIR="some directory"
dbdash=`ls -l $DBDIR | egrep '^d' | grep '.-.' | awk '{print $9}'`
</code></pre>

<p>And I want to drop every database with the same names with the folders in the variable "dbdash"</p>

<pre><code>dbhype=($dbdash)
    for dbtry in ${!dbhype[*]}
        do            
            mysqladmin -u$dbUser -p$dbPass 'drop database if exists `'${dbhype[$dbtry]}'` CHARACTER SET utf8 COLLATE utf8_general_ci;'
    done
</code></pre>

<p>But this error came out after running the script</p>

<blockquote>
  <p>mysqladmin: Unknown command: 'drop database if exists <code>folder_name</code> CHARACTER SET utf8 COLLAT'</p>
</blockquote>

<p>How can I delete these databases using script? Please help.</p>