18

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?

1
  • 1
    tried using double quotes " instead of single ' ?......of course you will still need to escape any $, ' and \ .
    – matt
    Jan 20, 2012 at 10:23

1 Answer 1

26

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>');});"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .