Re: Strange Bash Script Problem
On 8/12/19, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Mon, Aug 12, 2019 at 01:19:45PM -0400, Lee wrote:
>> On 8/12/19, Greg Wooledge <wooledg@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
/tmp/mydir1_apo
_apo: 2: cd: can't cd to mydir2
/tmp/mydir3_apo
$ cat test
while IFS=$' \t\r\n' read -r d; do
( cd ${d}_apo || exit
pwd
)
done < /tmp/input
$ od -c input
0000000 m y d i r 1 \n m y d i r 2 \r \n m
0000020 y d i r 3 \n
0000026
Thanks,
Lee
Reply to: