Question: write those scripts in linux 4 ) Delete all duplicate files Write a shell script to deleteDuplicate that deletes all files ( Keep one and
write those scripts in linux 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 with the
same name.
Your script should print an error if:
the first argument is not a type of directories
the number of arguments is not equal to two.
Sample:
countFiles Comp Comp
The following files appear in the directories Comp and Comp
Hello.java
Test.c
Final.html
dont use find or compare commands
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
