1846294 Members
3436 Online
110256 Solutions
New Discussion

script help

 
sstan
Frequent Advisor

script help

hi guys,
in a IF statement, how do I check for non-existence of word "NOT FOUND" let say using grep to grab the word from a file ,

for e.g
IF ! grep NOT_FOUND /test/log ; then

rgds,
3 REPLIES 3
Andreas Voss
Honored Contributor

Re: script help

Hi,

grep -q NOT_FOUND /test/log
if [ $? != 0 ]; then
....
fi

Regards
Steve Steel
Honored Contributor

Re: script help

hi

if [ !-n $(grep NOT_FOUND /test/log) ]
then
echo not found
fi

for shells

www.shelldorado.com

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
sstan
Frequent Advisor

Re: script help

thansk,.