I am using Kernel (macbook air laptop) Using one or more of the wild card charat
ID: 3881091 • Letter: I
Question
I am using Kernel (macbook air laptop)
Using one or more of the wild card charaters *, ? and range (also called set) like [abx] and [1-3] in the file pathname, issue appropriate command(s) to do the following. Note: You must show the use of the above three wild card characters individually in one or more commands for part (6) to 11) below.
1)Issue command to delete the wild directory
2)Using echo command answer whether you are able to delete a non-empty directory
3)Change working directory to the wild directory
4)Delete all the files using wild card characters without using –r option
5)Change working directory to parent directory
6)Delete the wild director
Explanation / Answer
Solution:-
1)Issue command to delete the wild directory
Answer:- rm *xxx*
2)Using echo command answer whether you are able to delete a non-empty directory
Answer:- if [ $(find $DIR_TO_CHECK -maxdepth 0 -type d -empty 2>/dev/null) ]; then
echo "Empty directory"
rm -rf {dirName}
else
echo "Not empty or NOT a directory"
fi
3)Change working directory to the wild directory
Answer:- cd working directory/**/wildDirectory
4)Delete all the files using wild card characters without using –r option
rm *filename
5)Change working directory to parent directory
Answer:- cd working directory/**/parendirectory
6)Delete the wild directory
Answer:- rm -r wild directory
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.