I want to write a script that generates commandline arguments for another program. Until know I have written a script that simply echo the arguments and use it in the following way:
external_program $(generate arguments)
This stops working as soon as the generated arguments require quotes. To be clear what I mean: The resulting function call should be equivalent to
external_program "First argument with spaces" "Second argument with spaces"
How can I write and call a script to achieve such behavior?
EDIT: The things that I cam change is the exact commandline to connect the output of generate with the input of external_program (which should be short because that is something that I will have to type in) and the generate script which can be as complex as required to do the job.
EDIT: The duplicates does not match my problem because I already know how to pass all input arguments to another script and I know how to print variables, but my question is how I can get the output of one program copied over to the input of another program, so that quotes string stay as one input argument of the second program. EDIT2: "input of another program" was bad phrasing. What I actually mean was commandline arguments of another program.
generatescript, so it can work in any way that solves the problem.generateprint each argument in a different line, then you can pass that toxargs.external_program $(generate arguments)is subject to word-splitting and glob-expansion, so it is a broken method that you should never use.