June 2017
Beginner
502 pages
11h 26m
English
We just saw some tests with one condition checked at a time, but we also have the equivalent of && and ||, so we can have compound checks and test more conditions at once, as follows:
#!/bin/bash echo "Hello user, please give me a number between 10 and 20, it must be even: "read user_inputif [ ${user_input} -ge 10 -a ${user_input} -le 20 -a $(( $user_input % 2 )) -eq 0 ]thenecho "Great! The number ${user_input} is what we were looking for!"elseecho "The number ${user_input} is not what we are looking for..."fi
And now some tests are:
zarrelli@moveaway:~/Documents/My ...
Read now
Unlock full access