These are the commands I need to execute in a script. The date 2011.02.14 needs to be a parameter:
mysql -开发者_如何学编程-user=myusername --password=mypassword
connect mydatabase
source /var/www/2011.02.14.sql
exit
How would I execute a script to do this?
Is the "mysql --user=myusername..." part of the script, or part of the command-line for executing the rest of the script?
Thanks much.
Enclose your commands in a here doc
mysql --user=myusername --password=mypassword << here_doc
connect mydatabase
source /var/www/2011.02.14.sql
exit
here_doc
精彩评论