I am trying to write a loop that operates on file names with embedded spaces. I am struggling (not for the first time!) with macros and compound double quotes.
How can I accumulate files names in a local macro over the loop, using quotes the handle the embedded spaces? How can I then operate on the resulting macros to extract each individual filename, including the spaces?
Here's a (non-)working example:
How can I accumulate files names in a local macro over the loop, using quotes the handle the embedded spaces? How can I then operate on the resulting macros to extract each individual filename, including the spaces?
Here's a (non-)working example:
Code:
foreach table in "A table" "Another table" { local alltables `"`alltables'"' `" "`table'" "' } * this looks right, because each table name is enclosed in quotes: di `"`alltables'"' * this doesn't look right, because quotes are not handled properly: foreach table of local alltables { di "table: `table'" }
Comment