Hi I am trying to execute the below code in unix but the script is going in infinite loop. Though the code looks to be perfect, i am unable to debug the error:
answer=y
while [ "$answer" = "y" ]
do
echo " Enter the word and filename"
read pname flname
grep "$pname" "$flname" > newlist
echo " Enter any more string to be searched (y/n)? "
read anymore
case anymore in
y) answer=y ;;
n) answer=n ;;
esac
done
case $anymoreprocase anymorewhich just examines the static string "anymore". Voting to close as simple typo.readwithout-rwill mangle backslashes. Shouldn't be an issue here anyway.