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
Post a Comment