Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Under your home directory, create a directory called Proj . 3 _ ID _ Sec# ( example Proj . 3 _ 1 2 3 0
Under your home directory, create a directory called ProjIDSec#example
Projsec and underneath it do the following: Write a shell script called myproj that,
when executed, displays the following four choices:
Your script should work on your own created files and
directories if they are needed
Welcome Message
Write a shell script that prints a welcome message when the user logs in It should display Good
morningGood afternoonGood evening depending on when the user logs in
When the myproj script is running, the welcome script displays the message automatically that displays the
following Menu, as shown below:
Good afternoon Muard Njoum
Please Choose one of the following options:
Directories:
Change Permission for All Directory.
Print all empty directories.
Files
Change Permission for All Files
Delete Duplicated files
Computer Science Department Faculty of Engineering and Technology
Linux OS Lab Comp
Due Date: Wednesday before : PM
Submission at Server
Projects All answers must be from Labs ONLY.
ANY STUDENT WHO USES A COMMAND NOT IN THE LAB MANUAL OR AI TOOLS
WILL NEVER BE GRADED, AND HE OR SHE WILL RECEIVE THE PROPER
ACADEMIC PUNISHMENT.
YOUR Work must be tested on your machine Laptop Before passing the
Project.
Report:
Count and display all files that contain the same word.
Count the number of files that have the same name inside different directories.
Exit Display a Goodbye message to the host
Clarification of ALL Scripts
Directories:
Change Permission for All Directory.
Write a shell script, chmodAllDirectories, that will change the permissions of all directories inside a given leading
directory. The command chmodAllDirectories newpermission maindirecroty should set a new permission to all
directories inside a given leading directory. The script should set a new permission for all directories inside the given
directory.
If there is no argument or the main directory is not a directory, the script should print an error message to stderr and
exit.
Sample
chmodAllDirectories students
Print all empty directories.
Write a shell script printEmptyDirectories maindirectory to print all empty directories as a full path. The
command printEmptyDirectories directory should only print all empty directories inside the given argument
directory.
Note: du command cannot be used in writing this script
If there is no argument or the main directory is not a directory, the script should print an error message to stderr and
exit.
Sample
printEmptyDirectories homestudentsu
homestudentsumydir
homestudentsudir
homestudentsutest
Files:
Write a shell script, removeX, that will remove x permission of a given file from a given set of directories. The
command removeX file d d ddn removes the execution property of file inside that is laying inside d d
ddn directories. If there is no argument, or if file is not a regular file or directory is not a directory, then the
script should print an error message to stderr and exit.
Delete all duplicate files
Write a shell script to deleteDuplicate that deletes all files Keep one and remove the other that are a copy of a
given file. The command deletes replication f f fn should remove all the files f through fn that are exact
copies of f Exact means that the file name and size are the same.
Sample:
Assume that the midterm file in directory dir has another copy inside directory dir
deleteDuplication dir dir
File midterm has been deleted from the dir directory.
If there arent two arguments or dir and dir are not a directory, the script should print an appropriate error message
to stderr and exit.
Report:
Count and display all files that contain the exact word:
Write a countWord script that accepts as many arguments as possible up to : the word to search for and a list
of directories. The script should display all files with their directories.
Your script should print an error if:
The first argument is not a type of regular file
The number of arguments is less than two.
Sample:
countWord Computer Comp Comp Comp
The Word Computer appears times in the following Files with the
corresponding lines
Compmidtermdoc line
Compresumetxt line
Comptechnologytxt line
CompMyfileshtml line
Count the number of files that have the same name inside different directories.
Write a countFiles script that accepts two directories as arguments: the script should display all files wi
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started