I'm trying to put together a script to bulk-update a bunch of database tables. I have a list in a file (but I could just as well have it from stdin), and I'm trying to construct the ALTER TABLE
commands. I have the following
while read table; do echo "ALTER TABLE $table ENGINE=Aria"; done < tables
which however outputs something like this
ENGINE=Ariamydatabase.mytableone
ENGINE=Ariamydatabase.mytabletwo
ENGINE=Ariamydatabase.mytablethree
instead of
ALTER TABLE mydatabase.mytableone ENGINE=Aria;
...
like I expected. What am I doing wrong? Eventually, I'd change echo
to mysql -uroot -ppassword -e"ALTER TABLE $table ENGINE=Aria;"
.