I have a shell script that is building a string that consists of the parts of a command that I want run at the end of the string. So it looks like this:
$PART1=/path/to/command
$PART2="-arg1"
$PART3="-arg2"
and so on.
At the end of the command is a list of files I get from a loop and place in its own string.
So in the end I end up with:
$PART1 $PART2 $PART3 $FILES
as the command I want to run.
The problem is that when the script is run the command ends up being:
/path/to/command -arg1 -arg2 '/path/to/file1 /path/to/file2'
if there are any spaces in the file names which there often are.
How can I get rid of the single quotes and just have the command be:
/path/to/command -arg1 -arg2 /path/to/file1 /path/to/file2
I am doing this as zsh script on OS X.
Thanks.