Script not waiting for user responce

hi all,

Im fairly new to scripting and am having a noobish issue. Ive got a script that checks for certain directories and if they dont exist, prompts the user to do a mkdir. heres trouble spot in the script:

cat dirlsttemp.dat | while read dir; do

echo "$dir does not exist, would you like to create it now? \(y or n\)"

read responce
if [ $responce == "y" ];

then
	mkdir $dir

else
	echo "$dir has not been created"

fi
done
fi

what essentially happens is it does not wait for the responce and goes right to the else. i believe it has something to do with reading from the cat...but I dont know any other way to read that file line by line. Any solutions?

#!/bin/ksh

for dir in $(< dirlsttemp.dat); do

    echo "$dir does not exist, would you like to create it now? (y or n)"
    read responce
    if [ $responce == "y" ]; then
       mkdir $dir
    else
       echo "$dir has not been created"
    fi
done

Try this

for input_dir_row in `cat dirlsttemp.dat`
do

if [ -d $input_dir_row ]
then
echo "$input_dir_row exist"
else
echo "$dir does not exist would you like to create it now y or n"
read entry

if [ $entry -eq "y" ]
then
mkdir $input_dir_row
fi
fi
done

thanks guys, that worked beautifully