Prev | Current Page 145 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"


Here is an example from the author??™s experience. This script is for a Unix computer. The script runs a grading
program against an output file for a student??™s project, then runs the student??™s original program against a smaller
???extract??? file as a second test, and finally prints a set of documents for the student. The script automates the
execution of a set of commands by accepting a set of parameters in the command line, and then using the values
of those variables to construct the appropriate commands and execute them. When using the script, the user
types ???gradeP??? followed by six character strings giving the name of the student??™s output file, the comments file
to be created, etc., and at last the student??™s name:
CHAP. 4] SOFTWARE 53
#! /bin/sh
# Script gradeP for grading the access_log projects
# Variables:
# $1 student??™s output file
# $2 comments/grading file to be created by
# program gradeProj.pl
# $3 student??™s source code
# $4 access_log_extract-report
# $5 path to student??™s directory
# $6 Name
# Run the grading program against the student??™s output file
gradeProj.pl $6 $5$1 $5$2
# Test the student??™s program against the extract file
$5$3 /home/fac/chr/public_html/plc/access_log_extract $5$4
# Print the results
nenscript -2 -r $5$2 $5$1 $5$3 $5$4
This script is a script in the Bourne shell (command interpreter) for Unix, and it flexibly executes a
set of commands that otherwise would require much more typing and be much more prone to errors of
execution.


Pages:
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
producent sal zabaw online loans for bad credit rating apartamenty przy plaży tanie noclegi nad morzem rewal przyczepy campingowe