This is the same loop I originally added in #4, but moved to prepare. It could instead be handled by the recipe, but I think this is generally useful enough to handle in cook.sh.
cook.sh
Fixes #14 (closed).