LAB ASSIGNMENT 7 Write a shell script to search through a list of directories an
ID: 3706141 • Letter: L
Question
LAB ASSIGNMENT 7 Write a shell script to search through a list of directories and interactively find space to recover Space could be recovered in several ways, but only with the user's confirmation for file removal. squeeze - size) [-d days) [directory1.) The script is actually 2 scripts. The top level seript is called squeeze and uses find to invoke the lower level script which should be named squeeze file The size and days options should be set using getopts inside squeeze. If size is omitted it should be set to 1000000. If days is omitted it should be set to 10. If there are no directories use the current directory. These options should be used with find to locate files which are either that size or larger or else modified at a time older than days number of days or named core or a.out The ?queeze file Ncript will be called with the name of 1 file which is either old or large or both. Inside squeeze.file you should present the file to the user in a while true loop to allow the user to decide what to do. The user can use commands 1, m, o, r, g, or c to indicate "Is -1 "more", "od-?", "rm", "gzip" or "continue". Commands 1, m and o perform an action without exiting the loop. Commands r, g and c perform an action and exit the loop. Actually c simply exits the loop Command r should only be done after confirming through prompting and reading a y, with either lower case or upper case with possibly more letters following the yExplanation / Answer
Here in the following program to search all the file names in the current directory which contains the letter 'f ' is detected.
for i in *
do
echo $i
if [ $i = "*f*" ]
then
echo "no"
else
echo "yes"
fi
done
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.