Adrian Veidt
Adrian Veidt

Reputation: 280

Shell script for mysql query execution shows error

I'm running the below script

mysql -u $_db_user -p$_db_password $_db << eof
INSERT INTO \`manufacturemap\`
(\`manufacture_id`\ `manufacture_name`\) VALUES (122,IBM)
eof
done
exit

but it shows the following Error

bad substitution: no closing "`" in `manufacture_name'\) VALUES    (122,IBM))

I've tried everything I know,Please help, kinda stuck here.

Upvotes: 0

Views: 44

Answers (1)

Sougata Bose
Sougata Bose

Reputation: 31739

Missing , and wrong \s in ->

(\`manufacture_id`\ `manufacture_name`\)

Should be -

(\`manufacture_id\`, \`manufacture_name\`)

No escaping needed -

INSERT INTO manufacturemap (manufacture_id, manufacture_name) VALUES (122, 'IBM')

Upvotes: 1

Related Questions