Here i have a list (/test/list) contains 3 words: foo, bar, bla . I tried run this code :
#!/bin/bash
list=$(cat /test/list)
for i in $list ;do
if [ "$i" = "foo" ]; then
echo "yes $i"
else
echo "no $i"
fi
done
But the output is:
no foo
no bar
no bla
How can i do for have:
yes foo
no bar
no bla
I have tried many things but nothing work. Thx for help.