I'm getting some mysql info from shell like this:
#!/bin/bash
keyOrPass=$1
intercom=$2
flat=$3
number=$4
mysql -ulogin -ppassword db_name << EOF
select codeGuestEmail, codePrivateEmail from mbus_clients WHERE flat=$flat and domophone=$intercom;
EOF
I found this solution in some tutorial, but it says:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'EOF'
What's wrong? How can I finish mysql session?
http://www.cyberciti.biz/faq/using-mysql-in-shell-scripts/ here is example of tutorial where I found solution.
UPDATE added different quotes to EOF doesn't work too.
in your query pass the dynamic variable with quotes ..
or try with this