From: Lao Ming on
On Nov 13, 1:23 am, pk <p...(a)pk.invalid> wrote:
> Lao Ming wrote:
> > I had the bright idea of setting IFS="\n" in my while loops as in:
> > while IFS="\n" read -r FILE
> > I thought that this worked great for processing directory names or
> > filenames with spaces in the name.  I didn't test it enough but it
> > seemed to work for several months.  Worst of all, I didn't detect this
> > issue until now.
> > Now I've just discovered that all folder names that end with the
> > letter 'n' are not getting processed because, for example,
> > "Compression" becomes "Compressio" and thus, later, not found.
> > Looking at the log file, it's definitely the IFS snipping that last
> > letter off.
> > So, do I abandon the use of this or am I just using IFS incorrectly or
> > in a manner that wasn't intended?
> You are using either "\" or "n" as IFS. To use a literal newline, you need
> IFS='
> '
> or, with shells that support that, IFS=$'\n'

I changed all the while loops to use the literal newline and the
problem went away. It's weird that I never saw it before though
because I started using the IFS="\n" several months ago. When I just
added a bin directory to the distribution, that's when it reared its
proverbial ugly head, I guess. Thanks a bunch to everybody.