Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
1  
tried using double quotes " instead of single ' ?......of course you will still need to escape any $, ' and \ . –  matt Jan 20 '12 at 10:23

1 Answer 1

up vote 6 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

 
discard

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.