On 2013-04-29 17:55, Mike Frysinger wrote: > On Monday 29 April 2013 02:55:12 Peter Rosin wrote: >> On 2013-04-29 04:45, Mike Frysinger wrote: >>> On Sunday 28 April 2013 03:21:15 Peter Rosin wrote: >>>> And on re-reading, my IFS changes are not very constructive. I removed >>>> those. I will push the attached in a couple of days, if there are no >>>> objections. >>> >>> i actually thought your IFS changes made sense. the current code >>> saves/restores IFS around the inside loop, so if your code breaks out of >>> both the inside and outside loop, then IFS won't get restored. >> >> The first statement of the inner loop restores IFS, so IFS is as it should >> be when "break 2" hits, no? > > so it does ... i was focusing on the code outside of the inner loop. why do > we need the restore at the bottom then ?
It's a pattern, if the for argument list is empty (which it isn't in this particular case) the inner loop is never entered. I also have this vague memory of someone saying that some shell restored IFS to the value it had before the for statement after each round in the for loop, but that might easily be some silly misunderstanding on my part (or the someone, whoever that was) and sorry for spreading misinformation in that case... Cheers, Peter