Shell: Nested for the loop

advertisements

Somehow in the following script, value of $i
is not expanded on line 3. Any idea why?

for i in `cat test.txt`
do
        for j in `find . -name $i`
        do
                echo $j
        done
done


for i in `cat test.txt | sed -e "s/\r//g"`; do find -name $i; done

big question: cygwin support sed?

or cygwin

d2u test.txt; for i in `cat test.txt`; do find -name $i; done

or linux

dos2unix test.txt; for i in `cat test.txt`; do find -name $i; done