Unit 4: Advanced Bash Scripting & Automation - Subjective Questions

CSC104 — It Fundamentals • Practice Questions with Detailed Answers

20 questions

1

Explain the concept of multi-function scripting in Bash. Describe how functions improve the organization, reusability, and maintenance of automation scripts.

2

Design and explain the structure of a robust multi-function Bash script that validates input, logs activity, handles errors, and performs a main task.

3

Describe how to create an interactive Bash menu with colors. Explain the purpose of ANSI escape sequences and discuss how user choices should be validated.

4

Compare the use of a case statement and nested if statements in an interactive Bash menu. Which approach is generally more suitable, and why?

5

Explain remote script execution in Bash using SSH. Discuss authentication, quoting, environment variables, file transfer, and security precautions.

6

Explain how JSON data can be processed with jq in Bash. Include examples of extracting fields, filtering arrays, and producing formatted output.

7

Describe how a Bash script can safely consume JSON returned by a web API. Explain the roles of curl, HTTP status checking, jq, and error handling.

8

Explain the main steps required to integrate the Cloudflare API into a Bash automation script for managing DNS records.

9

Differentiate between an API token and a global API key when authenticating to Cloudflare. Why is the principle of least privilege important?

10

Design an access log summarizer using Bash tools. Explain how the script could calculate request counts, status-code frequencies, top client IP addresses, and error rates.

11

Explain how pipelines can be used to build a compact access log analysis command. Discuss the purpose of awk, sort, uniq, head, and grep in the pipeline.

12

Describe how to send email from a Bash script using SSMTP or an equivalent lightweight SMTP client. Include configuration, authentication, message construction, and security concerns.

13

Compare pipes and redirection in Bash. Explain standard input, standard output, standard error, and the operators commonly used with each mechanism.

14

Explain the design and security requirements of a Bash password generator. Discuss randomness, password length, character selection, and handling of generated passwords.

15

Derive a secure workflow for generating a password and emailing it to an administrator from a Bash script. Identify the risks and controls required at each stage.

16

Explain the purpose of exit statuses in Bash automation. Describe how they should be used when chaining commands, pipelines, API calls, and remote execution.

17

Describe the architecture of an automated WordPress installation on a LAMP stack. Identify the role of Linux, Apache, MySQL or MariaDB, PHP, and WordPress.

18

Develop a step-by-step plan for automating WordPress setup on a LAMP server. Include idempotency checks so that the script can be safely rerun.

19

Explain how a Bash automation script should manage secrets when configuring Cloudflare, SMTP, and WordPress database access.

20

Explain the role of quoting and command substitution in advanced Bash scripts. Illustrate how incorrect quoting can affect remote commands, JSON data, filenames, and user input.