title: IF-THEN Statement used with grep not fuctioning in UNIX Script
body: <p>I have posted the same code for another question recently. I was helped with that but when trying to implement an If-Then statement, it returned erroneous results. So within this topic I will have 2 questions.</p>
  
  <p><strong>First Question:</strong>
  When performing a search within a file, how do you implement the search so uppercase or lower case has no basis on returning the desired record?</p>
  
  <p><strong>Second Question:</strong>
  In my If-Then statement no matter what I type it shows the else part of the If-Then Statement. For example, the name Smith is in the file, but no matter what I type "Smith" or "smith" yields the same result as "echo "Error: $last_name is not in file"".</p>
  
  <p><strong>Additionally:</strong>
  This has to be written in korn shell programming.</p>
  
  <p>The code is as follows:</p>
  
  <pre><code>#Gather search parameter
              read last_name
              if grep -Fxq "$last_name" $1
              then
                  while IFS=: read c1 c2 c3 c4 c5 c6 c7 rest ; do
                      case "$c1" in
                          "$last_name" )
                              echo -e "Last Name: $c1\nFirst Name: $c2\nCity: $c3\nState: $c4\nClass: $c5\nSemester Enrolled: $c6\nYear First Enrolled: $c7\n\n"
                          ;;
                      esac
                  done &lt; $1
              else
                  echo "Error: $last_name is not in file"
              fi
          ;;
  </code></pre>
  
  <p>Any insight into the coding of this would be much appreciated.</p>
  
  <p>EDIT:</p>
  
  <p><strong>User Input 1</strong></p>
  
  <p>User input: Smith</p>
  
  <p>Expected Output: 
  Last Name: Smith
  First Name: John
      ....</p>
  
  <p>Actual Output:</p>
  
  <p>Error: Smith is not in file</p>
  
  <p><strong>User Input 2</strong></p>
  
  <p>User input: smith</p>
  
  <p>Expected Output: </p>
  
  <p>Error: smith is not in file</p>
  
  <p>Actual Output:</p>
  
  <p>Error: smith is not in file</p>