1

I'm trying to automate a Magento site build and one of the challenges I'm having is updating the content of a page in the database through a command. When trying to do:

mysql -D magento -e "INSERT INTO cms_page ('content') VALUES ("<p style="text-align: center;"><a href="http://www.magentocommerce.com/knowledge-base"><img src="{{media url=&quot;36d3c9416834b86ba9a78b92d97325f556a2f32f.png&quot;}}" alt="" width="1200" height="630"></a></p>");"

I'm receiving this error:

-bash: syntax error near unexpected token `<'

I'm by no means a DBA, but I have a feeling the issue is that I'm not properly escaping the double quotes, or that it's running into the terminating ';' in the middle of the HTML and failing.

Any help would be appreciated.

1 Answer 1

1

You have to escape the double quote with \ them when you using them to mark the string start and end

mysql -D magento -e "INSERT INTO cms_page ('content') VALUES (\"<p style=\"text-align: center;\"><a href=\"http://www.magentocommerce.com/knowledge-base\"><img src=\"{{media url=&quot;36d3c9416834b86ba9a78b92d97325f556a2f32f.png&quot;}}\" alt=\"\" width=\"1200\" height=\"630\"></a></p>");"
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that was it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.