I'm missing something simple here. I'm trying to build up a command line in a script, then execute it. Here is the only version that actually works:
curl -s -F "files[]=@$file1" -F "files[]=@$file2" "$url"
However, I'll have a variable number of files to upload, so need to build another variable, adding the specific files. This is where I can't get it to work. If I can get this example to work, then I'll be able to extrapolate it for varying numbers of files:
ff="-F \"files[]=@$file1\" -F \"files[]=@$file2\""
curl -s "$ff" "$url"
I'm not a noob, but I've spent hours on this with no luck. I've used eval, $(), ${}, etc. The only way I've been able to execute the command successfully is the first example above. I can't seem to get my $ff parameter to execute.
As an aside, I would like to see how my command is being interpreted by bash. The 2nd command above echo's correctly, but it doesn't execute. Is there a way to find out exactly what was evaluated and run? It's obviously not the same as the echo, but I don't know what it is.