I have a few lines code.
I just want to check if argument $1 is in the file with a while loop so I write this code.
#!/bin/bash
if [ ! -z $1 ]
then
update=$1;
while read line
do
if [ $update == $line ]
then
echo "yes";
fi
done<./available_updates
fi
But in debugging if I run
[root@pc bagheri]# bash -x ./test.sh my_value
it says:
+ '[' my_value == 'my_value' ']'
and jump over that condition just because of these two single quotes and not printing the 'yes' word, but I am 100% sure that the my_value is existed in available_updates file. What should I do for that?