title: Search log file for string with bash script
body: <p>I just started learning PHP. I'm following <a href="http://phpacademy.org/" rel="nofollow">phpacademy's</a> tutorials which I would recommend to anyone. Anyways, I'm using XAMPP to test out my scripts. I'm trying to write a bash script that will start XAMPP and then open firefox to the localhost page if it finds a specific string, "XAMPP for Linux started.", that has been redirected from the terminal to the file xampp.log. I'm having a problem searching the file. I keep getting a:</p>
  
  <pre><code>grep: for: No such file or directory
  </code></pre>
  
  <p>I know the file exists, I think my syntax is wrong. This is what I've got so far:</p>
  
  <pre><code>loaded=$false
  string="XAMPP for Linux started."
  
  echo "Starting Xampp..."
  
  sudo /opt/lampp/lampp start 2&gt;&amp;1 &gt; ~/Documents/xampp.log
  
  sleep 15
  
  if grep -q $string ~/Documents/xampp.log; then
  
      $loaded=$true
      echo -e "\nXampp successfully started!"
  
  fi
  
  if [$loaded -eq $true]; then
  
      echo -e "Opening localhost..."
      firefox "http://localhost/"
  
  else
  
      echo -e "\nXampp failed to start."
      echo -e "\nHere's what went wrong:\n"
      cat ~/Documents/xampp.log
  
  fi
  </code></pre>