2012-12-07 5 views

Répondre

1

Vous pouvez essayer ceci:

grep -Fxq $name1 test.txt 
if [ $? -eq 0 ]; then 
    ... test.txt contains $name1 ... 
else 
    ... test.txt does not contain $name1 ... 
fi 
1

Vous pouvez faire comme ceci:

match=`grep $name1 test.txt` 
if [ -n "$match" ]; then 
    echo found 
fi 
0

Suffit-il:

grep $name1 test.txt 
Questions connexes