title: BASH - incorrect execution of if else
body: <p>While writing a Makefile for a program (I wanted to check whether a particular directory exists or not, and if it does not exist, it performs some python code execution. Here is the code - </p>
  
  <pre><code>if [ -d "$(LOGOFOLDER)"]; then \
      echo "Directory already present." ; \
  else \
      mkdir -p $(LOGOFOLDER) ;\
      $(PYTHON) ./generate_logos.py -d ;\
      echo ; \
      echo "Logo generated."; \
  fi
  </code></pre>
  
  <p>However, every time I run the Makefile, the else part is executed (regardless of whether the file exists or not). Could anyone explain me where am I going wrong? Thanks. </p>