Escaping Perl oneliner single quotes when run from a bash shell

Written by James McDonald

March 5, 2009

Google said

perl -le 'print "It\047s True";'

But after playing around for a while I found this worked:

perl -le 'print "It''\'\''s True";'

Thats double quote It single quote singlequote backslash singlequote backslash singlequote singlequote s True double quote 🙂


BTW Ubuntu 8.04

1 Comment

  1. kykyboss

    nice one, you just saved me a lot of time (and fustration)


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…