I would like do something like
./call_with_options $(./get_options)
where the command call_with_options, has for example options -i and -o, and the command get_options outputs a string like
-i"first file" -i"second file" -o"some output"
i.e. it generates a set of multiple options that take arguments which can contain spaces and as such need to be quoted. I want the call above to be equivalent to executing
./call_with_options -i"first file" -i"second file" -o"some output"
effectively replacing '$(./get_options)' as-is by whatever its output is such that it can still be interpreted by the shell.
I've tried something obvious like
get_options:
#!/bin/bash
echo -i"first file" -i"second file" -o"some output"
or
#!/bin/bash
echo "-i\"first file\" -i\"second file\" -o\"some output\""
but this does not work. For only a single option it works, but once there are multiple that also can contain space I cannot figure out how to tell the call_with_options command to interpret the output correctly.
I saw various similar questions but they did not help me solve this specific problem. Something like the accepted answer of bash command output as parameters seemed relevant, but I still do not know how to handle the spaces correctly with this. Also note that xargs will not help (as far as I can tell) because I do not want to run call_with_options on each of the options, but on the whole set.
Is this somehow possible and how?