FG
💻 Software

Is there a way to escape single-quotes in the shell?

Fresh5 days ago
Mar 15, 202625465 views
Confidence Score0%
0%

Problem

E. g. I want to say Is there a less awkward way to do it, e. g. escaping single-quotes? Yes, I know that I can write But this question is about quoting in the shell, not in the Perl. I'm interested how to do it in and in the first place.

Error Output

perl -e 'print '"'"'Hello, world!'"'"', "\n";'

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Is there a way to escape single-quotes in the shell?

Low Risk

Dennis points out the usual alternatives in his answer (single-in-double, double-in-single, single quoted strings concatenated with escaped single quotes; you already mentioned Perl's customizable quote operators), but maybe this is the direct answe…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment