Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a simple string I want to echo from my bash script:

$(document).ready(function() {$('#cf-footer-paragraph').append('<p>Revision 12345</p>');});

But any how I try to add \ before # I cant echo it=( So I wonder - how to echo such command?

share|improve this question
tried using double quotes " instead of single ' ?......of course you will still need to escape any $, ' and \ . – matt Jan 20 '12 at 10:23
up vote 11 down vote accepted

Because you already have single quotes in the string, use double quotes, and escape only the $ sign:

echo "\$(document).ready(function() {\$('#cf-footer-paragraph').append('<p>Revision 12345</p>');});"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.