Subject: | ^ needs quoting as it is a pipe operator in the Bourne shell |
Date: | Tue, 25 Oct 2016 21:40:12 +0100 |
To: | bug-String-ShellQuote [...] rt.cpan.org |
From: | Stephane Chazelas <stephane.chazelas [...] gmail.com> |
The "^" character is a pipe operator just like "|" in the Bourne
shell (for backward compatibility with the Thompson shell).
That was dropped by ksh and POSIX, so most modern "sh" don't
treat it specially anymore.
However the documentation for String::ShellQuote does mention
"Only Bourne shell quoting is supported" and one can still find
the Bourne shell around on some systems like the /bin/sh of
Solaris 10 and older.
$ perl -MString::ShellQuote -le 'print shell_quote @ARGV' echo 'a^b' | sh
sh: b: not found
With zsh, ^ is also special when the extendedglob option is
enabled (a negation globbing operator).
$ perl -MString::ShellQuote -le 'print shell_quote @ARGV' echo 'a^b' | zsh -o extendedglob
zsh: no matches found: a^b
-----------
Related, and I'm not sure it's worth a separate bug report, and
that's a regression since 1.03. The "=" character is also
special as the first character of a word in zsh. So while
$ perl -MString::ShellQuote -le 'print shell_quote @ARGV' echo '=a=' | zsh
=a=
was OK in 1.03. It isn't any more in 1.04:
$ perl -MString::ShellQuote -le 'print shell_quote @ARGV' echo '=a=' | zsh
zsh: a= not found
--
Stephane