I have a MySQL command in a bash script I'm running. I'm running other Linux command line commands before this one (in fact one is even a mysql command) but when it gets to this one, it doesn't work:
DEST_HOST="localhost"
DEST_DBNAME="db_name"
DEST_DBUSER="root"
DEST_DBPASS=""
# FILE NAME
MIGRATION_FILE="migration_database"
# Export/Import Commands
DO_DATABASE_UPDATE="mysql --host=$SOURCE_HOST --user=$DEST_DBUSER --password $DEST_DBNAME < $MIGRATION_FILE.sql"
echo 'Running local updates...'
$DO_DATABASE_UPDATE
echo "$DO_DATABASE_UPDATE"
# Done!
echo "Complete!"
I have the migration_database.sql file in the folder that I'm running it from. As you can see, I'm printing out the UPDATE command at the end of everything. What happens is that I run this and it just prints on the mysql menu like I ran mysql -I to get the help menu.
If I copy and paste the command that is printed out and run it, it works great. I'm not sure why bash doesn't execute this from within the script.
Any ideas?