Question: Write a Bash script which inputs a string from the user which is supposed to be a directory. Test to make sure it is a

Write a Bash script which inputs a string from the user which is supposed to be a directory. Test to make sure it is a directory and if so, iterate through its contents using an iterator for loop to total up the number of words on each regular file in the directory. This will require that you test that the item is a regular file and then use wc -w to obtain the number of words. Because wc also returns the filename, you will have to use awk to return just the word count (which is the first of the two items wc -w returns).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!