arguments - Bash test command operators -
I just started in Bash scripting, and I do not have to find out what the logic is ( See for more information. There are many other test operators; This is not an exhaustive list. -a and
-n ). Do they have bug logic or self-generated logic? If ["$ UID" -ne "$ ROOT_UID"] then "should be run as root" encode $ E_NOTROOT fi [-n "S1"] then < P>
Memnon for -ne is 'not equal'; It compares arithmetic comparisons to two values for inequality.
-n is not empty 'empty'; It tests whether the argument (
"$ 1" in this case) is an empty string. If
$ 1 is defined and there is no other value than the empty string, then the test is correct.
- command, also known as
[, supports other numerical comparison operators:
-lt (less than),
-le (less than or equal to),
-gt (more than),
-ge (Greater or equal to), and
-ike (equals). The
-z operator tests for a zero length string ??? But note that the argument should be enclosed in double quotation marks, however (
[-z "$ variable"] ) is not otherwise for any exam,
-z is not.
Comments
Post a Comment