Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

IT210 Lab Project 8

Due: March 20 at 11:59 pm

To complete part of the assignment, you will need to use the uncompressed Files2 folder and the
file dirfile.txt

#1 should be saved to and run from the same directory level as Files and Temp in Files2.
#2 should be saved to the same directory level as dirfile.txt
Save each script with the extension .sh
For each script, change the permissions so they can be executed.
Include your name and script # inside commentary lines in each file.

1. Create a shell script that changes the following permissions:


a. Clear all permissions for all files in the Files and Temp directories.
b. Add read permissions for the user for all files in the Files directory that begin with N
c. Add write permissions for the group for all files in the Temp directory that contain the
extension .exe
d. Add read and write permissions for all others that begin with Y and end with .txt in the
Files directory.
e. Do a long file listing of only the specified files from 1b, 1c and 1d and send the results to a
single file.

2. Create a shell script that accepts parameters and uses grep to search for patterns:
a. The script will accept three parameters representing, in order, a file extension, a year
and a new filename.
b. Use grep to search dirfile.txt for all lines that end with the file extension represented by
the first parameter, and write the results to the filename represented by the third
parameter.
c. Use grep to search dirfile.txt for all lines that include the year represented by the second
parameter, and write the results to the filename represented by the third parameter.
Show only the lines that contain the year in the year column.

Test the file with the following when the script is run: bat 2022 and a filename of your
choice.

Submit the two scripts and the output files created in each script to Moodle.

You might also like