title: Trying to make a if statement that will move on after it's done something in bash
body: <p>I was wondering if someone could help me out. </p>
  
  <p>So, I am trying to make a script a little bit smart. </p>
  
  <p>I want it to check if a folder exists and if it does just move on but if it does not then it will create a folder for me and then move on to the next part of the script. </p>
  
  <p>The issue is I can get it to make the folder but then the program just dies, I am a little stuck and scratching my head a little. </p>
  
  <p>Now I have a If statement but It will create the folder and then just stop. </p>
  
  <pre><code>    TEMPDEST="/home/user/folder"
  
  
          if [ ! -d "$TEMPDEST" ]; then
            # Control will enter here if $DIRECTORY doesn't exist.
            echo -e "\e[31mOh, I could not find the folder but it's fine I will create one for you now =D!\e[0m"
            mkdir $TEMPDEST
          fi
  
  #Moving into said dirctory to make sure everything is in one folder.
          cd $TEMPDEST
  
  Other stuff.... 
  </code></pre>
  
  <p>I am using bash on a CentOS machine.</p>
  
  <p>Thanks, 
  Callum.  </p>