On Mon, Aug 12, 2019 at 01:37:16PM -0400, Lee wrote: > On 8/12/19, Greg Wooledge <wool...@eeg.ccf.org> wrote: > > On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote: > >> On 8/12/19, Greg Wooledge <wool...@eeg.ccf.org> wrote: > >> > P.S. it would also have been possible to work around the carriage > >> > return > >> > issues with IFS, but your dos2unix approach is perfectly valid as well. > >> > >> Just out of curiosity - how? > > > > while IFS=$' \t\r\n' read -r d; do ... > > Doesn't work for me. What am I doing wrong? > > $ sh test
You're running sh. The $'...' feature I'm using is bash only. > $ cat test > while IFS=$' \t\r\n' read -r d; do > ( cd ${d}_apo || exit > pwd > ) > done < /tmp/input Try "bash test" instead of "sh test". Also, you want double quotes around "${d}_apo", or at least around the "${d}" part. wooledg:~$ printf 'foo\r\nbar\r\n' > foo wooledg:~$ while IFS=$' \t\r\n' read -r d; do printf %s "$d" | od -tx1 -An; done < foo 66 6f 6f 62 61 72