Using ! operator on a shell command -


i'm trying write script if particular string not present in file.

i know in order check if string available, can like:

if grep -qi "sms" $file; 

but how combine ! operator shell command?

just add in front of condition make evaluate on contrary:

if ! grep -qi "sms" $file; echo "yes"; fi    ^ 

test

$ cat hello bye $ if ! grep -qi "sms" a; echo "sms not found"; fi sms not found 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -