Friday, 13 September 2013

run mysql command string which is stored in a variable

run mysql command string which is stored in a variable

In Bash I have following code:
alterCmd=alter table $tablename modify $columnname $columntype not null\;
| mysql -ulogin -ppw -A $databasename
Normally I do:
echo alter table $tablename modify $columnname $columntype not null\; |
mysql -ulogin -ppw -A $databasename
and it works. But I have to build up alterCmd and run it at the end.
How can I run the command that is stored in alterCmd?

No comments:

Post a Comment