The objectives of this lab experiment are to make you :
bash scriptingcmd scriptingThis is the first of two labs on scripts. Both labs ask you do something in bash and again in cmd. It is up to you whether you do the scripts first or second in cmd. In general, what ever is possible to do in cmd is also possible to do in bash and vice versa, but the relative levels of ease may be different.
All work is expected, but not required, to be carried out in the Operating Systems and Internet Security (OSIS) Lab, 429 Russ. But, you are welcome to work wherever. Note that use of both Linux and Windows and other software, that may not always be installed in other facilities, may be needed.
This lab depends on the following topics covered in the following lectures: file name regular expressions, procedures in bash and cmd, bash script file details, and cmd script file details. Before beginning to work on this lab, you must have read the notes on bash and cmd given in the References.
c1 | c2 | c3 < inputInfo.txt >>
outputCollection.txt
The above should be "useful", and you are choosing what the c1, c2,
and c3 are and their arguments, if any. [Hint: Re-read Min list
of Linux commands.] Explain what your pipeline construction does in the
answers.txt file.cleanUp.sh Script: This is about keeping a
directory free of "junk" files. To be specific, we want to remove
files that are backups and auto-saved versions.
cleanUp() that deletes
all backup and auto-save files from the given directory . Assume that
names of back up files end in either(i) ~ or (ii)
.bak, and (iii) auto-save files have names beginning with
a #.cleanUp()
procedure. The test() procedure should (i) create a new
directory named TEST in the current directory, create a few files
(say a dozen each of names chosen by you) that fit the three categories
of junk files in TEST, (ii) list-long the TEST directory, (iii) invoke
cleanUp TEST, and again (iv) list-long the TEST
directory.cleanUp.bat and
testScript.bat equivalent to the above in the cmd
syntax. Use standard commands that come with Windows
cmd, not the ones in cygwin.answers.txt
file.answers.txt file.Note the number <n> of this Lab from the course home page and use
L<n> as the first argument to turnin. In addition to
the text input files, and the script files you created, turn in
myLabJournal.txt, answers.txt, and the usual
ReadMe.txt as explained in Expectations.
cmd, you may wish to
web-search in addition to reading the following: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?mfr=true
![]() |
Grading Sheet
for
Weight 5% |
| Student | LoginID | Bonus | Points |
| Item description | MaxPts | Points |
ReadMe.txt,answers.txt, and
myLabJournal.txt are submitted with expected content |
10 | . |
| bash pipeline construction: works (5 points), useful (10 points), clever (5 points) | 20 | . |
bash cleanUp() Delete all backup and auto-save
files. |
10 | . |
| bash test harness | 10 | . |
cmd: cleanUp Delete all backup and auto-save files. |
10 | . |
| cmd test harness | 10 | . |
| ReadMe.txt commentary on comparative ease of scripting | 15 | . |
| ReadMe.txt on performance comparison | 15 | . |
| Late submission -2% per day late; not accepted after 2 days | -- | . |
| Extraneous files submitted: -2 points per file | -- | . |
Files were not submitted using turnin program: -10
points |
-- | . |
| Total | 100 | . |
| Copyright © 2009 pmateti@wright.edu | Oct 4, 2009 |