Shell Scripting and Automation Questions

Shell-language craft for operations work: Bash and POSIX sh scripting, pipes and redirection, quoting and word splitting, exit codes and set -euo pipefail (including failures inside pipelines), traps and cleanup, argument parsing with getopts, functions and arrays, parameter expansion, here-documents, and text processing with grep, sed, awk and jq, including streaming pipelines over very large log, CSV and JSON Lines files. Also covers writing robust, idempotent, portable scripts (locking, atomic file updates, retries with backoff, safe temp files, GNU versus BSD differences), background jobs and signals, bounded parallelism and SSH fan-out, cron-driven jobs such as log rotation, backups, atomic deploys and health-check watchdogs, secure scripting (eval injection, secrets, path traversal), and debugging, testing and linting shell with ShellCheck and bats. Boundary: general automation design and Python or Go tooling, Linux host administration tasks, observability and alerting design, security detection engineering, and generic algorithmic coding problems are covered elsewhere.

HardTechnical
22 practiced

Design a Bash script that runs an incremental load from cloud object storage: list new files since the last run, prevent concurrent runs, download and transform them, verify checksums, record progress safely and recover cleanly from a mid-run failure.

MediumTechnical
34 practiced

Read many gzipped JSON Lines files, extract id, timestamp and value, write one CSV with a single header, and remove duplicate ids. Show the pipeline and explain how it stays streaming.

MediumTechnical
18 practiced

Write a Bash function that runs a command and retries it on failure with exponential backoff and jitter, up to a configurable number of attempts, preserving the command's last exit status and logging each attempt. Where would you apply it, and where would retrying be wrong?

MediumTechnical
21 practiced

How do you parse JSON reliably in a Bash script? Show how to extract fields, handle missing keys and arrays, and what you would do if the usual tool is not installed.

HardTechnical
24 practiced

Each line of a JSON Lines file looks like {"user":{"id":123,"name":"a"},"events":[...]}. Produce CSV rows with user id, name and event count in one shell pipeline, and explain how it handles nulls and missing fields.

That is every published Shell Scripting and Automation question for Cloud Engineer so far. Browse the other topics in this category, or practice this one interactively.