Interview Prep/Shell Scripting/Scenarios: writing and hardening scripts

Other teams want to use your script as a CLI tool. What do you add before sharing it?

BeginnerScenarioScenarios: writing and hardening scripts
Answer

Situation read → Shared tools need a stable interface, versioning and documentation.

What I'd do →

  1. --help with usage, options, examples and exit codes; --version printing a version stamped at release.
  2. Consistent option parsing and validation; non-zero exit codes documented.
  3. Dependency check at startup (require_cmd jq curl aws) with install hints.
  4. A README, a CHANGELOG and semantic version tags in Git.
  5. Distribution: a release tarball or package with checksums, or a container image; never "curl from main | bash".
  6. CI with ShellCheck, shfmt and bats.

Why → Without versioning, a change you make for your team silently breaks theirs.

Interview tip → Mention keeping backward compatibility for flags, or deprecating them with a warning first.

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Scenarios: writing and hardening scripts