79651612

Date: 2025-06-03 16:47:23
Score: 1.5
Natty:
Report link

I am going accept the answer from @EdMorton as best here, the main reason is that it allows me to:

deserial() {
        declare function_to_call="$1"
        declare -n assoc_array_ref="$2"

        while IFS= read -r -d '' line; do
            assoc_array_ref+=( $line )
        done < <($function_to_call)
}

and then simply call deserial func Y - this populates the associative array Y with what was returned from function func universally.

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @EdMorton
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Albert Camu