arguments - Bash test command operators -


I just started in Bash scripting, and I do not have to find out what the logic is ( -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.

See for more information.

- 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.

There are many other test operators; This is not an exhaustive list.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -