How comes 'test -n' returns 'true' in bash? -


I was wondering how it comes

  test -n  < / Pre> 

returns 'true', for example:

  if test -n; Then echo "yes"; Else "No" echo; Fi   

"Yes" prints, even if the test is given, theoretically, there is an option with an empty-length string with -n option, which checks that String length is 0 false) or something else (true returns).

Thanks

This gives the correct test x for the same reason Returns correct - string -n is non-empty This is not using the -n option because -n is second Logic is required and you have not provided one.

  test -n "" || Echo false x = "" test -n $ x & amp; Amp; Test the truth- n "$ x" || False echo   

Each echo command executes; Note, in particular, in the middle!

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -