I have a simple question, I think, but I can’t find the solution for it.
A simple perl script prints out following line "tests - Blub" "tests - Blub - Abc" and I assign it to a variable like that var=$(perl ...), but why can’t I parse it to an array with varArray=( $var ) and that command varArray=( "tests - Blub" "tests - Blub - Abc" ) works?
The expected result should be like this:
tests - Blub
tests - Blub - Abc
And not like this:
"tests
-
Blub"
"tests
-
Blub
-
Abc"
Thanks for any advices.
Here’s some doodling:
Clearly the 3rd result is what you want. When you populate your variable from the output of the Perl script, the double quotes within it have no special meaning to the shell: they’re just characters. You have to get the shell to parse it (with
eval) so that their meaning is exposed.