Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

work of -z in unix

Tags:

unix

if [ -z "${ABC}" ] 
then
LOGDIR=`${JAVA_HOME}/bin/java -cp ${a}/aim.jar my.app.util.GetLogDir "${rsp}"`

Can some one help me with this. What this if is exactly doing. Is it checking if abc exists and the calling GetLogDir's main with some arguments?

like image 534
user1731553 Avatar asked Oct 10 '12 17:10

user1731553


2 Answers

   -z string
              True if the length of string is zero.

To check whether ABC is empty. If it is then the command will be executed and result will be in the LOGDIR.

like image 52
P.P Avatar answered Sep 22 '22 06:09

P.P


From man test:

 -z string                   True if  the  length  of  string
                             string is zero.
like image 43
RJ Cuthbertson Avatar answered Sep 22 '22 06:09

RJ Cuthbertson