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 🙂

Enjoy.

BTW Ubuntu 8.04

1 Comment

  1. kykyboss

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

    Reply

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…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...