A script that works in isolation is not a production script. A production script handles unexpected inputs, survives network failures, resists malicious data, runs correctly under concurrent execution, and produces useful diagnostics when it fails. Debugging and hardening are the disciplines that close the gap between 'works on my machine' and 'works reliably in production for 18 months'.
Debugging Bash scripts is different from debugging compiled code. There is no debugger with breakpoints and watchpoints — the primary tools are trace output (`set -x`), strategic `echo` statements to stderr, and the careful construction of minimal failing examples. The debugging workflow is investigative rather than interactive, and the skills to apply it efficiently come from understanding Bash's evaluation order and exit code semantics.
Hardening covers the security and robustness properties that prevent scripts from being exploited or failing in unexpected ways. This includes input sanitisation, protection against path traversal, safe temporary file creation, lock files for preventing concurrent execution, and timeout protection for network operations. Each hardening technique is a response to a real failure mode that occurs in production.