Here, we come to something really useful for our scripts, a bunch of operators that will enable us to perform some tests and react as a consequence. So, we will be able to make our script react to a some change or user input and be more flexible. Let's see what is available.
Logical operators
Logical NOT (!)
The NOT operator is used to test whether an expression is true and holds true when the expression is false:
[! expression ]
Let's go back to one of our previous scripts and make it more user-friendly:
#!/bin/bash
echo "Hello user, please give me a number between 10 and 12: "
read user_input
if [ ! ${user_input} -eq11 ]
then
echo "The number ${user_input} is not what we are looking for...