title: Shell script interpretation code and parameters
body: <p>I have the following shell script and they ask me to know how works and what the $1 and $2 parameters are.</p>
  
  <pre><code>#!/bin/bash
  
  for i in `sort $1`; do   
      if grep $2 $i &gt; /dev/null; then 
          echo A  
          cp $i /tmp  
          exit  
      fi  
  done  
  echo B;
  </code></pre>
  
  <p>My question is this: $1 can not be a directory because you can not sort on directories. Therefore, it must be a file. But the "for i in file" function implies that we will work for each line and the 'grep' tool does not work with lines.</p>
  
  <p>I have considered that it should be a file that contains files, but for now I can only think of the tar files and it does not work with them.</p>
  
  <p>Thanks!</p>