how to compare the runtime input with text file

I want to compare the input and text file word.
The text file has:
one
two
three
Run time input assigned to a variable var:
read -p " enter the value : " var
while read first
do
  a=$first
  if [ "$a" == "$var" ]
  then
    echo  " $var is found "
  else
    echo " $var is not found "
    read -p " please enter correct value " $var
  fi
done < word.txt
I tried above code in my script, but it is not working.

Комментарии

Популярные сообщения из этого блога

Unable to construct Application instance [duplicate]

What is considered 'insulting a Muslim'? And is it a sin? If so, is it a minor or major scene?