Artificial intelligent assistant

Usage of -n and -z in test built in - Bash Consider the following in bash: root@debian-lap:/tmp I=$(echo) root@debian-lap:/tmp echo "$I" root@debian-lap:/tmp [ -z "$I" ] && echo "TRUE" || echo "FALSE" TRUE This means that variable $I is `zero`. The same I could achieve with negation test to see if variable is non zero, and `!` makes test reverse so it checks is variable `zero` root@debian-lap:/tmp ! [ -n "$I" ] && echo "TRUE" || echo "FALSE" TRUE root@debian-lap:/tmp So, my question is, are there any special cases when to use `-z` and `! -n` , or vice versa `! -z` and `-n` as they are basically doing the same test? Thanks

You are given `-n` and `-z` for the same reason that other test suites give you both `==` and `!=`, or `AND` and `NOT`. Some test cases can be made a lot clearer to future maintainers by eschewing double-negatives. Also, as mentioned in an above comment, ancient incarnations of `sh` (i. e. the Bourne and Thompson shells), as opposed to modern POSIX `sh` did not have a `!` keyword to negate the truthiness of `test` expressions.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy bb70eb70ca54fda2fbbaa0dbf8234a08