On 8/12/19, Greg Wooledge <wool...@eeg.ccf.org> wrote:
> 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".

yup -- that was it
$ bash test
/tmp/mydir1_apo
/tmp/mydir2_apo
/tmp/mydir3_apo

>  Also, you want double quotes
> around "${d}_apo", or at least around the "${d}" part.

What's the difference between ${d} and "${d}"?  Or is that a bashism
also? (all my scripts use /bin/sh so I'm pretty clueless wrt bash)

Thanks
Lee

Reply via email to