Question: Write a Bash script that performs the following steps: Takes the name of a file or directory as an argument. If no argument is provided,
Write a Bash script that performs the following steps:
Takes the name of a file or directory as an argument. If no argument is provided, prompt the user to enter the name.
Determines whether the input is a file or a directory.
If it's a directory:
a Check if the user has read and execute permissions on the directory. If not, display a warning message.
Count the number of files and subdirectories within it
If the user has the necessary permissions, display the list of all files and subdirectories along with their respective sizes.
If it's a file:
a Check if the user has read permission on the file. If not, display a warning message.
If the user has read permission, determine the word count, line count, and character count of the file. Based on the character count, categorize the file as follows:
"Text Heavy" if the character count is greater than
c "Moderately Sized" if the character count is between and
"Light File" if the character count is less than
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
