perl代写

INet 3101_001 C Programming: Language and Applications

Lab 3 Scripting Languages

The (numbers) denote things we will be grading for in the lab. I.e. (2) is for the 2nd grading element, not to do anything that many times.

This lab assignment, for which you may work in groups of two, will require you to build a shell script that will call 2 Perl program scripts. In addition to calling the 2 Perl scripts, your shell script will be the main interface presenting a menu of options to the user as well as have a built in function to sort a data file. Your shell script will need to (1) accept a valid filename at the start of execution, which will be a file that will contain data in the form of a list of words, one per line, and at least 50 words (/usr/share/dict/words).

This filename will be used in your shell for both a (2) shell function to sort the data in the file and write it to another file in that format, as well as a (3) call to a Perl script that will do the same thing using Perl functions. As with the shell script, the Perl script will sort the file, but the shell script is responsible for writing the sorted data to another file. (4) With either the shell or the Perl way to sort the original file, you will need to prompt for a filename to write the sorted data into.

To start your shell, you will be required to (5) ensure that the user started the shell passing in a filename, and if not either prompt for the filename, or exit the shell with a USAGE : statement. Once in the shell you will prompt the user with a (6) menu interface that will allow the user to select sorting of the file using the shell, sorting using the Perl script, another Perl script, or exit.

Your second Perl script will also use the filename gathered at the start of the shell script, but this Perl script will (7) search for a word in that file and return the line number(s) that word is on, or a “not found” message. This Perl script will require you to (8) open the file in the Perl script and prompt the user for the word to search for. You can (9) prompt the user either in the shell or the Perl program for the word you are looking for.

INet 3101_001 C Programming: Language and Applications

Menu

$ lab3.sh /usr/share/dict/words

Menu

——-

  1. 1)  Shell sort
  2. 2)  Perl sort
  3. 3)  Perl search
  4. 4)  Exit

    Enter selection :

    If user does not add a filename at the command line, prompt for a filename, if none

given, then exit. You also need to test for the existence and that the file is not of 0 size. If it doesn’t exist or is of 0 size, exit with USAGE: “enter a filename that exists…”

Grading Criteria

Submit :

  1. Shell script
  2. Text file with words
  3. 2 Perl scripts
  4. Script file recording use
  5. Design Document

Grading Requirements Rubric

INet 3101_001 C Programming: Language and Applications

Grading Topic

A Level Work (80-100%)

B Level Work (60-80%)

C Level Work (40-60%)

D Level Work (20-40%)

Points / 100

README.txt

Clear​​ concise​​ explanation of functionality / design supported with information on a breakdown of modules / functions to support program and thoughts on how to achieve goals. Defined with all team members, email, ID. Document NOT in MS Word format

Messaging

explaining functionality of program and supporting algorithms / thoughts on how to achieve functionality

Messaging

explaining functionality on program.

Lack​​ ​of definition, and/or​ ​​little description of functionality​.

10 pts

Accept filename or prompt user if none given

All​​ ​​functionality is complete with the ability to accept a filename, but prompt user if none given

Most

components required complete execution.

Some

functionality of function properly working.

Function

defined to accept input

10 pts

Shell sort

All​​ ​​functionality is complete with prompt for output – shell outputs to new file

Most

components required complete execution.

Some

functionality of function properly working.

Function

defined to accept input

10 pts

Perl sort

All​​ ​​functionality is complete with prompt for output – shell outputs to new file

Most

components required complete execution.

Some

functionality of function properly working.

Function

defined to accept input

20 pts

Perl search

All​​ ​​functionality is complete with function definition in a header file or at the top of the program. Return values defined and tested from calling function. All passed variables are done properly.

Open file in perl script and prompt for word you are looking for in shell or perl script

Most

components required complete execution.

Some

functionality of function properly working.

Function

defined to accept input

25 pts

Menu

All​​ ​​functionality is complete with a full functioning menu that will accept all options as well as deal with errors.

Most

components required complete execution.

Some

functionality of execution of programs – possible program failure.

Prompt ​​for user input and achieve output to user

15 pts

Testing output with script file

Script file ​clearly shows all​​ use cases and defines for another tester / quality engineer how to achieve the same results. All test are complete with both successful and failure conditions to ensure full functionality

Most​​ of the use cases are displayed and repeatable by instructor

Achieve​​ a small % of use cases

Script file

demonstrates

output of your program

10 pts

INet 3101_001 C Programming: Language and Applications