Question: 3 . 3 . ( Script 3 ) You are supposed to write a shell script that will count the number of files stored in
Script You are supposed to write a shell script that will count the number of files stored in the directory given as the script execution parameter. For test purposes, a test environment has been prepared in the script check system with some files. You must use loop instruction. Your script will be executed in the command line as:
scriptname dirname
Suppose youve got the following directory structure:
A
atxt size bytes
btxt size bytes
ctxt size byte
dtxt size bytes
For the example execution:
scriptname A
your script should return
The only thing your script is expected to return is a number reflecting the total number of files in the given directory. Neither, runtime messages nor error messages should appear on the screen you may need to redirect the standard error stream for operations that might be a source of any kind of error as command devnull
Your solution will be marked concerning the correctness of the file counting operation.
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
