When I execute a MySQL query from the shell script using value as variable, it shows
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com' at line 1
my code
#!/bin/bash
email='new_user@gmail.com'
# Checking - is the email already exists,
email_exists=$(mysql -u username -ppassword -e "SELECT id FROM db.user where email=$email;")
no problem when using inline (without using a variable).
FYI: I am using email as a variable because I need to reuse somewhere in code.