Question
3.3. (Script 3) You are supposed to write a shell script that will count the number of files stored in the directory given as the
3.3. (Script 3) 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 the test purposes a test environment has been prepared in the scriptcheck system with a number of files. You must use loop instruction. Your script will be executed in the command line as:
scriptname dir_name
Suppose youve got the following directory structure:
A-
-a.txt (size 5 bytes)
-b.txt (size 7 bytes)
-c.txt (size 1 byte)
-d.txt (size 4 bytes)
For the example execution:
scriptname ./A
your script should return 4.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started