title: Syntax error when running .sh script on linux. What am I doing wrong?
body: <p>I've been attempting to write a shell script to detect composer and git on a virtual linux  = Ubuntu 16.0.4 machine and then install them if needed. + clone the required repository if the machine is ready for it.
  Now this is my first attempt to write any kind of script and also sorry if somehow I messed up the question itself, I'm quite now on stackoverflow as well.</p>
  
  <p>Any help is appreciated, thanks in advance.</p>
  
  <p>Here's the original task specification I received initially:</p>
  
  <p>-check if git is installed on server
  if so, clone repo with codebase</p>
  
  <p>-check if composer is installed on server
  if so, composer install in the root directory of the laravel application</p>
  
  <p>-finally, php artisan migrate --seed</p>
  
  <p><strong>Now this is how I was trying to achieve this:</strong> </p>
  
  <pre><code>#!/bin/bash
  echo "The installation process is about the begin..."
  
  
  if ! which git;
      then echo "Git has been located on the destination system. Cloning begins..." 
  git clone &lt;link to the gitlabe repo&gt;
  
  else echo "There is no Git installed on the system. Git installation     commences..."
  
          sudo apt-get update
          sudo apt-get upgrade
          sudo apt-get install git
  
          echo "Cloning begins..."
          git clone &lt;link to the gitlabe repo&gt;
  fi
  
  if ! which composer;
  then
      echo "Composer has been located on the destination system."
  else
      echo "There is no Composer installed on the system. Composer installation commences..."
          sudo apt-get update
          sudo apt-get upgrade
          sudo apt-get install composer
  fi
  
  sudo apt-get update
  sudo apt-get install curl php5-cli git
  curl -sS https://getcomposer.org/installer | sudo php -- --install-    dir=/usr/local/bin --filename=composer
  
  
  
  
  
  composer global require "laravel/installer"
  
  
  sudo apt-get update
  
  'Now the preferred version in the vagrantfile has to be edited to be 1.8.1             instead of 1.9'
  
  'Generate a ssh key' 
  ssh-keygen -t rsa -b 4096 -C "&lt; e-mail adress that I used &gt;"
  
  'Start ssh agent eval $'  
  ssh-agent -s
  
  'Add your SSH private key to the ssh-agent' 
  ssh-add -K ~/.ssh/id_rsa
  
  
  php artisan migrate --seed
  </code></pre>
  
  <p><strong>The error message I recieve:</strong> </p>
  
  <pre><code>sudo sh ./testscript.sh
  [sudo] password for linuxtest: 
  The installation process is about the begin...
  : not foundt.sh: 3: ./testscript.sh: 
  : not foundt.sh: 4: ./testscript.sh: 
  : not foundt.sh: 5: ./testscript.sh: 
  ./testscript.sh: 72: ./testscript.sh: Syntax error: end of file unexpected (expecting "then")
  </code></pre>