What is -z if [-z "$ {FILE_LIST}"]

In this case, -z in the shell script if [ -z "${FILE_LIST}" ] ?

+1
source share
4 answers

[ matches test . And man test gives:

  -z STRING the length of STRING is zero 

Note. On some platforms [ is a symbolic link or hard link to test

+4
source

From help test :

  -z STRING True if string is empty. 
+3
source

-z for a string of zero length.

+2
source

I think if you use bash then it will return true if the length of the string is zero (so in your case there are no files in the list).

+2
source

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


All Articles