Ok so I have a bit of an update, although I'm not sure if it means much. I have changed my sublist text file to be a string so it looks like this:
001 002 003 ...
I've also added a few more printf commands (thanks for that tip) to get an idea of what it's doing. It looks like it now can read the sublist_string.txt correctly, but now I get new errors on the foreach line for the following options:
foreach sub (${sublist})
foreach sub ${sublist}
foreach sub $sublist
error - foreach: words not parenthesized
foreach (sub) ${sublist}
foreach (sub) $sublist
foreach (sub ${sublist})
foreach (sub $sublist)
error - foreach: variable name must begin with a letter.
So I apparently need to both use parentheses and not use parentheses? How does that work?