Shell read command is not waiting for user input

Hi,

i am working on one automation , for that i have writing one shell program that take user input in "while read line" block. but read command is taking value that is readed by While block.


while read line; do
command 1;
command 2

echo -n "Do you want to continute > "
read rsp
echo "You entered: $rsp"
if [ $rsp =='Y' ]; then
echo "Going to next step.."
fi
done<PART_TAB.txt

After running this shell script ,

-n Do you want to continute >
You entered: MSC:MSC_NET_RESOURCE_AVAIL
./Defrag_Exec.sh[130]: test: argument expected

In output,MSC:MSC_NET_RESOURCE_AVAIL is the vlaue that is readed by while block from PART_TAB.txt file.Please let me know where the problem is

thanks

Both read s take input from stdin, which is redirected from your .txt file. One option (taken from the links at the bottom of this page) would be to to address the terminal directly:

read rsp < /dev/tty

Thanks Rudi, you solved my issue.