Hey guys, I'm trying to prompt the user to enter Y or N in the middle of a while loop, but the read command is simply drawing in the next value.
I'm reading from a simple file full of words (one per line)
Code:
while read line
do
echo $line
grep $line dict #check if its in dictionary file
if [ $? -ne 1 ]
then
echo Match found
else
echo "Would you like to add '$line' to the dictionary? (Y / N)"
read promptadd
echo "you said $promptadd"
fi
done < myfile
The read line automatically takes the value of the next word from the file here. How do I interrupt and make it so the user is prompted?
Mahalo