Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions