0

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?

1 Answer 1

1
alterCmd="alter table $tablename modify $columnname $columntype not null;"
echo "$alterCmd" | mysql -ulogin -ppw -A $databasename
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.