title: Using grep inside shell script gives file not found error
body: <p>I cannot believe I've spent 1.5 hours on something as trivial as this. I'm writing a <strong>very</strong> simple shell script which greps a file, stores the output in a variable, and echos the variable to STDOUT.</p>
  
  <p>I have checked the grep command with the regex on the command line, and it works fine. But for some reason, the grep command doesn't work inside the shell script.</p>
  
  <p>Here is the shell script I wrote up:</p>
  
  <pre><code>#!/bin/bash
  
  tt=grep 'test' $1
  echo $tt
  </code></pre>
  
  <p>I ran this with the following command: <code>./myScript.sh testingFile</code>. It just prints an empty line.</p>
  
  <ul>
  <li>I have already used chmod and made the script executable.</li>
  <li>I have checked that the PATH variable has <code>/bin</code> in it.</li>
  <li>Verified that <code>echo $SHELL</code> gives <code>/bin/bash</code></li>
  <li>In my desperation, I have tried all combinations of:
  
  <ul>
  <li><code>tt=grep 'test' "$1"</code></li>
  <li><code>echo ${tt}</code></li>
  <li>Not using the command line argument at all, and hardcoding the name of the file <code>tt=grep 'test' testingFile</code></li>
  </ul></li>
  <li>I found this: <a href="https://stackoverflow.com/questions/18954067/grep-fails-inside-bash-script-but-works-on-command-line">grep fails inside bash script but works on command line</a>, and even used <code>dos2unix</code> to remove any possible carriage returns.</li>
  <li>Also, when I try to use any of the grep options, like: <code>tt=grep -oE 'test' testingFile</code>, I get an error saying: <code>./out.sh: line 3: -oE: command not found</code>.</li>
  <li>This is crazy.</li>
  </ul>