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
18 practiced

Write a backup script that takes incremental snapshots of a data directory, keeps daily, weekly and monthly generations, verifies each backup and cleans up on failure. What would make you distrust its first successful run?

MediumTechnical
22 practiced

Design the skeleton of a Bash command-line tool with start, stop and status subcommands and a global verbose flag. It should print helpful usage on invalid input and return exit codes that callers can script against.

MediumTechnical
23 practiced

A script with #!/bin/sh works on your laptop but fails inside an Alpine container. What Bash-specific features probably crept in, how do you find them, and how do you decide between rewriting for POSIX sh and just requiring Bash?

HardTechnical
17 practiced

Write a deploy script that releases a new build into a web root with no downtime and a fast rollback: unpack into a timestamped directory, verify its integrity, switch traffic over atomically, and prune old releases. It should run under plain /bin/sh.

HardTechnical
21 practiced

A deployment hook rewrites a configuration file that a running service re-reads, for example a systemd unit file. Design the update so the service never sees a half-written file, an invalid file is never installed, and a failed deploy can be rolled back.

Unlock Full Question Bank

Get access to all 40 Shell Scripting and Automation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.