Question: write a shell script that will count the number of files stored in the directory given as the script execution parameter. You must use loop

 write a shell script that will count the number of files

write a shell script that will count the number of files stored in the directory given as the script execution parameter. You must use loop instruction. Your script will be executed in the command line as: scriptname dir name Suppose you've got the following directory structure: A-1 a.txt (size 5 bytes) L-b.txt (size 7 byte Borders L-c.txt (size 1 byte) L-d.txt (size 4 bytes) For the example execution: scriptname./A your script should return 4. The only thing your script is expected to return is a number reflecting the total number of files of the given directory. Neither, runtime messages nor error messages should appear on the screen (you may need to re-direct the standard error stream for operations that might be source of any kind of error as "command 2>/devull")

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!