Question: ( c ) ( 2 points ) Give the command to produce the file listing as provided above. 1 2 . Consider the following bash

(c)(2 points) Give the command to produce the file listing as provided above.
12. Consider the following bash script and answer the questions that follow the line numbers are used so questions can refer to specific lines):
1. #!/bin/bash
2. # Assign $1 argument to $dir, if $1 is empty, use'' as default.
3. dir=${1-'.'}
4. if [-d "$dir" ]; then
5. echo "Files found: $(find "$dir" -type $ | wc -1)."
6. echo "Dirs found: $(find "$dir" -type d | wc -1)."
7. else
8. echo "[ERROR] Please retry with another folder."
9. exit 1
10. f1
(a)(2 points) Name and explain the purpose of #!/bin/bash in line 1.
(b)(2 points) Explain what line 3 does.
(c)(2 points) Briefly explain what the if-statements checks in line 4.
(d)(5 points) Explain the line 5 and 6, paying special attention to the piping command (vertical bar).
Page

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!