Decode the statement!!

What will the below statement do ?:confused:

[ -z "$VAR" ] &&
{
[ -x "/bin/setup" ] && {eval `/bin/setup 1`} || [ -d "/tmp/" ] && { VAR="/tmp" }
export $VAR;
}

Read about

 
man test
 
[ -z "$VAR" ]
 check the $VAR is empty or not
    -z string  True if  the  length  of  string  string is zero.
 
 [ -x "/bin/setup" ] -- if it is empty, then check whether /bin/setup is having the execute permission for that user 
 If the user has execute permission, then execute the setup file with argument 1
 If the user didnt have the execute permission, then check whether we have a directory called /tmp [ -d "/tmp/" ] and if it is there, then set the VAR variable value as /tmp
 and export it

---------- Post updated at 03:39 PM ---------- Previous update was at 03:36 PM ----------

for && ||

example is

 
if [ condition ] then
echo "True"
else
echo "False"
fi

can be write like below

 
[ condition ] && echo "True" || echo "False"

With that

export $VAR

It'll likely break is what it'll do. It should simply be: export VAR

Thanks for the replies, I got this now :slight_smile: :b::slight_smile: