in reply to Re: Having to manually escape quote character in args to "system"?
in thread Having to manually escape quote character in args to "system"?
Thank you, everyone, for very enlightening answers, I've learned quite a few things from them.
Unfortunately, ShellQuote::Any::Tiny doesn't do it right:
>perl -MShellQuote::Any::Tiny=shell_quote -E "system $^X, '-E', 'say f +or @ARGV; <STDIN>', 1, shell_quote(qq(\x5c \x5c)), 2" 1 \\ \ 2
because it escapes every backslash. But only terminating one, which precedes the closing double-quote (if any), should be escaped -- as follows from "Everyone quotes command line arguments the wrong way".
Win32::ShellQuote appears to handle everything correctly.
Actually, I lived happily before this, relying only on Perl's built-in ability to double-quote arguments, which contain spaces. Until someone, in her wisdom, decided that a double-quote in the middle of template name, to be passed as argument to another script, is a good idea.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Having to manually escape quote character in args to "system"?
by choroba (Cardinal) on Sep 13, 2017 at 11:57 UTC | |
by Anonymous Monk on Feb 17, 2023 at 12:49 UTC | |
Re^3: Having to manually escape quote character in args to "system"?
by choroba (Cardinal) on Sep 19, 2017 at 08:59 UTC | |
by vr (Curate) on Sep 20, 2017 at 11:53 UTC |