I am running Kubuntu 20.04. The perl version is shown by perl -v to be
perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi (with 50 registered patches, see perl -V ...
I have made apt-get update and with Muon package manager I have all installed perl packages upgraded.
But after that, perl is 5 as before, I have not got perl 6.
I need to use the command qx{..}, i.e. backtick command in order to get the result of linux xxd utility.
On that way I use in a konsole terminal the shell bash with following script, with intentionally an error in the variable $WEx
:
perl -we '$WEx=q{"date|"<>"}; print "\nWEx: ~", $WEx, "~\n\n"; $WEa=<<"EOT";
echo -n \\\\\\"$WEx\\\\\\";
EOT
print "\nWEa: ~", $WEa, "~\n";
print qx! $WEa !, "\n\n";'
The result are these lines:
two lines showing WEx
and WEa
and an error message:
WEx: ~"date|"<>"~
WEa: ~echo -n \\\""date|"<>"\\\";
~
sh: 2: Syntax error: Unterminated quoted string
==
The error message comes from this this code:
qx! $WEa !
That means, in a spawned shell the command line contained in the variable $WEa is to be executed.
i.e. this shell command:
echo -n \\\""date|"<>"\\\";
i.e. the shell should execute the command "echo", and "echo" has to output the text in the argument that follows.
"echo" should output the text literally without regard what it is, if a command or not, if a command with failure.
But instead, the text is executed as if being a command, and because the false double quote, the error message is given.
I have tried many days with various writings and various codes.
The shell allways cannot handle the line given by the backtick command correcly.
What I am making false?