And beware, if you redirect the input or output of the loop as a whole, you won't be able to get the variables out at all (as the loop will be executed by a child shell).