At 11:37 -0800 1/3/03, Paul Choy wrote:
"Paul Choy" writes:
>Hi :
>
>I am trying to run Expect scripts to interact with mysql. So far I cannot get
> it to work here is the list of log I got.Does anyone know how to interact Ex
>pect scripts with mysql. What am I missing ?
I've done it, but I don't spawn directly. I spawn a regular shell
and then just send out the command to start it, eg
# start up command line interface to mysql
send "/usr/local/mysql/bin/mysql -u root -p $dbname\r"
and go on from there. Works just fine.
--Cindy
I just tried using expect on Jaguar, and didn't find it necessary to spawn a shell. Here's my script:
% cat junk spawn /usr/local/mysql/bin/mysql test send "select version();" expect "mysql>" send "select now();\r" expect "mysql>" send "quit;\r" expect EOF And here's the result of running it: % expect junk spawn /usr/local/mysql/bin/mysql test select version();Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 52 to server version: 4.0.8-gamma-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select version();select now(); +-----------------+ | VERSION() | +-----------------+ | 4.0.8-gamma-log | +-----------------+ 1 row in set (0.01 sec) +---------------------+ | now() | +---------------------+ | 2003-01-03 16:08:06 | +---------------------+ 1 row in set (0.01 sec) mysql> quit; Bye --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
