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.

MediumTechnical
17 practiced

Write a script that waits for a local service to accept connections on a port, retrying with growing delays and a per-attempt timeout, and fails with a non-zero status if it never comes up. How would you use it in a container entrypoint or CI step?

MediumTechnical
18 practiced

Write a script that makes sure a particular cron job line exists in the current user's crontab without creating duplicates, and that is safe if two instances run at once. Explain how it behaves on repeated runs.

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.

HardTechnical
19 practiced

How do you test shell scripts? Show a test for a script that parses arguments, handles a missing file and logs, including how you substitute external commands, and where integration tests in a container fit.

HardTechnical
19 practiced

Implement argument parsing in Bash for a tool that supports both short and long forms of help, verbose and an output option, combined short flags, and any number of positional files. What are the limits of the built-in parsing facility, and what would you do instead?

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.