What does -n do in if [-n "$ {TEMP_FILE_LIST}"]?

What does -n do in if [ -n "${TEMP_FILE_LIST}" ] for this shell script?

+6
source share
3 answers

From help test :

  -n STRING STRING True if string is not empty. 
+17
source

-n tests for a string with zero length

+5
source
 if [ -n "${TEMP_FILE_LIST}" ] 

checks if the argument "${TEMP_FILE_LIST}" zero length.

You can also check

 if [ ! -z "${TEMP_FILE_LIST}" ] 
+4
source

Source: https://habr.com/ru/post/898495/


All Articles