The objectives of this lab experiment are to make you :
Bash scripting PowerShell scriptingThis is the first of two labs on scripts. This lab is about invoking programs interactively, and writing short little procedures. The second one is about more involved scripting. Both labs ask you do something in Bash and again in PowerShell. It is up to you whether you do the scripts first or second in PowerShell. In general, whatever is possible to do in PowerShell is also possible to do in Bash and vice versa, but the relative levels of ease may be different.
Note the Required Readings listed in the References.
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 PowerShell, Bash script file details, and PowerShell script file details. Before beginning to work on this lab, you must have read the notes on Bash and PowerShell given in the References.
(c1 | 2 | c3 ) < inputInfo.txt >>outputCollection.txtanswers.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.c1 | c2 | c3 >> outputCollection.txtanswers.txt file.cleanUp.ps1 and testScript.ps1
equivalent to the above in the PowerShell
syntax. Use standard commands that come with Windows, 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 the file called myLabJournal.txt, and the usual
ReadMe.txt and answers.txt as explained in Expectations.
![]() |
Grading Sheet for
CEG 233: Linux and Windows
Weight 5% |
| Student | LoginID | Bonus | Points |
| Item description | MaxPts | Points |
ReadMe.txt, answers.txt and myLabJournal.txt are submitted
with expected content |
05 | . |
| Bash pipeline construction: works (5 points), useful (5 points), clever (5 bonus points) | 10 | . |
Bash cleanUp() Delete all backup and auto-save files. |
10 | . |
| Bash test harness | 10 | . |
| PowerShell pipeline construction: works (5 points), useful (5 points), clever (5 bonus points) | 10 | . |
PowerShell: cleanUp Delete all backup and auto-save
files. |
10 | . |
| PowerShell test harness | 15 | . |
| answers.txt commentary on comparative ease of scripting | 15 | . |
| answers.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 | . |