code.sh
This file contain following data
input="/path/data.txt"
while IFS= read -r line
do
read -p 'Enter the name' name
if(("$name"=="$line"))
then
echo "matched"
fi
done < "$input"
data.txt
This file contain following data
John
David
taker
I have 2 files. file one is code.sh
and second data.txt
. The above code in code.sh
file only read
data from data.txt
. I want to access data from data.txt
and conditional statement not working on $line
. How can we apply operation on $line
variable
The above code we do not comparing string we want to use data that we access from txt file. After accessing data we will be to compare string.