INTRODUCTION TO UNIX       
                   =======================

                       Laboratory #7
                       =============

       1. Run the program and examine the output when you
          provide a name on the command line and also when 
          you run the progra, without any arguments.

#
#
          echo "I am printimg a name"
          if test "${1}" = "" 
             then 
             name=$LOGNAME
            else
            name="${1}"
          fi

       2.   Program accepts several file names as arguments
            and prints out its contents using the cut option
#
#
#           Usage: loop1 file1 file2 .....
#
#
             for i in $*
             do
             cut -c 1-8 $i
             done


        3.  Program calculates the average length of each 
            word in
            the files specified on the command line.
#
#
#           Uasge: loop3 file1 file2 ........

            for file in $*
             do
             totchar=`wc -c ${file} | cut -c1-8`
             totwords=`wc -w ${file} | cut -c1-8`
             echo $totchar $totwords
             average=`expr ${totchar} / ${totwords}`
             echo ${file} ${average}
             done

       
        4.   Progarm gets several command line arguments and tests 
             if it is a directory, or an ordinary file. Outpts the
             number of such occurences. Prints out the total as well


             ord=0
             dir=0
             if test ${#} -lt 2
             then 
             echo "No file name specified"
             echo "USAGE: ${0} file1 file2 ......"
             exit 1
             fi
               for i in ${*}
               do
               if test -f "${i}"
               then
               ord=`expr ${ord} + 1 `
             fi
              if test -d "${i}"
              then
              dir=`expr ${dir} + 1 `
             fi
               done
                 echo "Number of ordinary files: ${ord}"
                 echo "Numberof directories: ${dir}"
                 echo "Total nuber of files processed: ${#}"