Not Operator in ShellScript

The NOT logical operator reverses the true/false outcome of the expression that immediately follows.

For example, if a file does not exist, then display an error on the screen.

name="saurav sharma"
othername="gaurav sharma"
if [[ ! ${othername} == ${name} ]]
    echo "both are same"

now let's run the above the program

└─$ ./
both are same

Demo Video

Click Here for Demo Video