Not Operator


Definition: Performs logical negation on an expression.

 

Before you go any further remember, the Scripting Guys don’t make up these operators; we just report back what they do. The NOT operator is designed to test whether an expression is false. If an expression isfalse then the NOT operator reports back True. If an expression is true, then the NOT operator reports back False.

 

Like we said, we don’t make these things up, although, now that we think about it, this one doessound like something the Scripting Guys would come up with, doesn’t it?

 

For example, this command uses the NOT operator to evaluate the following expression 10 * 7.7. = 77:

 

$a = -not (10 * 7.7 - eq77)

 

Because this expression is true, if you run this command and echo back the value of $ a you’ll get the following:

 

False