thefirefly
New Member
Hi
For example, I have a text file contains the words below.
$cat sometext.txt
call
attended
Executed below
$egrep 'call|attended' sometext.txt
call
attended
$ echo $?
0
As excepted the exit status is 0
Now egrep with a word that is not in sometext.txt
$ egrep 'call|zzz' sometext.txt
call
$ echo $?
0
This is because 'call' is in sometext.txt.
I wanted the exit to be 1 as long as a word is not sometext.txt.
How can I do that?
Thanks
For example, I have a text file contains the words below.
$cat sometext.txt
call
attended
Executed below
$egrep 'call|attended' sometext.txt
call
attended
$ echo $?
0
As excepted the exit status is 0
Now egrep with a word that is not in sometext.txt
$ egrep 'call|zzz' sometext.txt
call
$ echo $?
0
This is because 'call' is in sometext.txt.
I wanted the exit to be 1 as long as a word is not sometext.txt.
How can I do that?
Thanks