Task #2. Write a shell script (script2.sh), listing all the files and directorie
ID: 3885269 • Letter: T
Question
Task #2. Write a shell script (script2.sh), listing all the files and directories created in Task#1 (you may use 1s or find command here), (1) to output a shell file (script3.sh) which will delete all the files and directories when it is run, (2) to run this output script (script3.sh) to delete all the files and directories, and (3) to show all the deletion done (by listing all the files and directories after the deletion - by showing that there is no files and directories). Copy and paste your shell script (script2.sh) here ______________ Copy and paste the output (script3.sh) here ___________ Copy and paste the output of script2.sh run. _____________Explanation / Answer
[1] Script2.sh
for i in "$Dir_Name"
do
if [ -f "$i" ];then
echo "$i"
fi
done
-----------------------------------------------------------------------------------------------------------------------------------------
script3.sh
rm -fr Directory_Name
-----------------------------------------------------------------------------------------------------------------------------------------
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.