Something like this may work.
# Make helper output an array assignment
% helper
options=( --arg1='foo bar' --arg2='another string' )
# Use eval to actually define the array using the output of helper
% eval "$(helper)"
% echo "${options[0]}"
--arg1='foo bar'
# Call program using options instead of helper directly
% program "${options[@]}"
Quoting is part of the shell syntax, and you cannot have shell syntax embedded in parameters. You could also try
% eval "program $(helper)"
although I recommend against such broader use of eval
. As with any use of eval
, you need to be careful with what helper
outputs, so that no unintended code is run.