title: Unix Bash Shell Programming if directory exists
body: <p>So I'm trying to get into an if statement in a bash shell script but I think I'm doing something wrong, anyways here's my sample code.</p>
  
  <pre><code>#!/bin/bash
  read sd
  if [ -d "~/tmp/$sd" ]; then
      echo "That directory exists"
  else
      echo "That directory doesn't exists"
  fi
  ;;
  </code></pre>
  
  <p>Am I pointing it to the correct directory? I want the user to input something which will be put into "sd" and if that subdirectory exists then it'll say it does, if not then it will go to the else and say it doesn't exist.</p>