title: Writing a bash script
body: <p>I need to write a simple bash script called finduser, where classlist is the name of the classlist file, and username is a particular student's username, either first name or last time.
  ./finduser classlist username</p>
  <p>The script should</p>
  <ul>
  <li>check that the correct number of arguments was received and print an error message if not,</li>
  <li>check whether the classlist file exists and print an error message if not,</li>
  <li>print the line of the given username in the classlist file</li>
  </ul>
  <p>This is what I have so far but I am stuck!</p>
  <pre><code>#!/bin/bash
  # check the correct number of arguments was received an print an error message if not
  read classlist
  echo &quot;There are $# arguments&quot;
  
  # Check if the classlist file exusts and print error message if not
  echo &quot;checking if file exists&quot;
          classlist=./classlist.txt
          if [ -f $classlist ]
          then
                   echo &quot;$classlist exists.&quot;
          else echo &quot;$classlist does not exist
          fi
  
  # print the line of the given username
  
  grep $2 $1
  
  </code></pre>
  <p>This is the text file</p>
  <pre><code>Alexander, Amy Elizabeth          BS      BADM          ACCT
  Ayers, Brittany Nicole            BS      BADM          ACCT
  Brown, Lyeshea Semondre Shayron   BS      BADM          ACCT
  Calloway, Logan Mackenzie         BS      BADM          ACCT
  Childers, Jamie Leigh             BS      BADM          ACCT
  </code></pre>