Monday, 15 April 2013

Unexpected EOF in mysql shell script -



Unexpected EOF in mysql shell script -

i'm getting mysql info shell this:

#!/bin/bash keyorpass=$1 intercom=$2 flat=$3 number=$4 mysql -ulogin -ppassword db_name << eof select codeguestemail, codeprivateemail mbus_clients flat=$flat , domophone=$intercom; eof

i found solution in tutorial, says: check manual corresponds mysql server version right syntax utilize near 'eof' what's wrong? how can finish mysql session? http://www.cyberciti.biz/faq/using-mysql-in-shell-scripts/ here illustration of tutorial found solution. update added different quotes eof doesn't work too.

in query pass dynamic variable quotes ..

select codeguestemail, codeprivateemail mbus_clients flat='$flat' , domophone='$intercom';

or seek this

select codeguestemail, codeprivateemail mbus_clients flat=${flat} , domophone=${intercom};

mysql shell

No comments:

Post a Comment