April 2018
Beginner
284 pages
7h 3m
English
As well as testing string values of bash scripts, we can test for integer values and whole numbers. Another way of testing the input of a script is to count the numbers of positional parameters and also test if the number is above 0:
test $# -gt 0
Or using the brackets, as follows:
[ $# -gt 0 ]
When in a relationship, the top positional parameters of the $# variable represent the number of parameters passed to the script.
There are many tests that can be done for numbers: