I tried using this code in a script, but it just created what is inside the backtick. In this example, "echo" table-db "" was created in the database. He did not create a folder name with a hyphen in the request
hyph=`ls -l $DBDIR | egrep '^d' | grep '.-.' | awk '{print $9}'`
dbhype=($hyph)
for dbtry in ${!dbhype[*]}
do
mysql -u$dbUser -p$dbPass -e 'CREATE DATABASE IF NOT EXISTS `echo "table-db"` CHARACTER SET utf8 COLLATE utf8_general_ci';
echo "Database ${dbhype[$dbtry]} created."
done
source
share