perl - parsing values into array -
i have simple question, think, can't find solution it.
simple perl script prints out following line "tests - blub" "tests - blub - abc"
, assign variable var=$(perl ...)
, why can't parse array vararray=( $var )
, command vararray=( "tests - blub" "tests - blub - abc" )
works?
the expected result should this:
tests - blub tests - blub - abc
and not this:
"tests - blub" "tests - blub - abc"
thanks advices.
here's doodling:
$ bash $ a='"tests - blub" "tests - blub - abc"' $ ary=( $a ); echo ${#ary[@]} 8 $ ary=( "$a" ); echo ${#ary[@]} 1 $ eval ary=( $a ); echo ${#ary[@]} 2
clearly 3rd result want. when populate variable output of perl script, double quotes within have no special meaning shell: they're characters. have shell parse (with eval
) meaning exposed.
Comments
Post a Comment