title: grep output different in bash script
body: <p>I am creating a bash script that will simply use grep to look through a bunch of logs for a certain string. </p>
  
  <p>Something interesting happens though. </p>
  
  <p>For the purpose of testing all of the log files the files are named test1.log, test2.log, test3.log, etc.</p>
  
  <p>When using the grep command:</p>
  
  <pre><code>grep -oHnR TEST Logs/test*
  </code></pre>
  
  <p>The output contains all instances from all files in the folder as expected.</p>
  
  <p>But when using a command but contained in the bash script below:</p>
  
  <pre><code>#!/bin/bash
  #start
  
  grep -oHnR $1 $2
  
  #end
  </code></pre>
  
  <p>The output displays the instances from only 1 file.</p>
  
  <p>When running the script I am using the following command: </p>
  
  <pre><code>bash test.bash TEST Logs/test*
  </code></pre>
  
  <p>Here is an example of the expected output (what occurs when simply using grep):</p>
  
  <pre><code>Logs/test2.log:8:TEST    
  Logs/test2.log:20:TEST    
  Logs/test2.log:41:TEST    
  Logs/test.log:2:TEST    
  Logs/test.log:18:TEST
  </code></pre>
  
  <p>and here is an example of the output received when using the bash script:</p>
  
  <pre><code>Logs/test2.log:8:TEST    
  Logs/test2.log:20:TEST    
  Logs/test2.log:41:TEST
  </code></pre>
  
  <p>Can someone explain to me why this happens?</p>