Scripting
Cheat sheet · https://pcornel.dk/topic.php?topic=5212
Answer
Scripting is the cross-language automation layer for turning explicit inputs and control logic into bounded actions with observable results, failure semantics and target-level verification.
Remember
- Script execution ≠ automation outcome; a process can finish successfully while the requested target state is still wrong.
- Language syntax ≠ operational safety; correct syntax does not provide validation, authorization, idempotency or rollback by itself.
- Output text ≠ proof; logs and stdout must be correlated with exit/exception state and independent target observation.
- Generic scripting semantics ≠ PowerShell, Python or Bash specifics; language-specific syntax and libraries remain in their dedicated branches.
First checks
shellcheck script.sh— Bash lintInvoke-ScriptAnalyzer -Path script.ps1— PowerShell lintruff check . / python -m py_compile script.py— Python checks
Verify in this order
script → lint → test → run → logs/exit code
Where it usually breaks
A script reaching its end or returning a success code proves only the script execution boundary; it does not prove each side effect occurred or the requested service state is correct without independent verification.
Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.
Scripting scripting boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Input / runtime | Effective inputs, runtime, working context and dependency versions are explicit | Hidden defaults, stale environment, wrong interpreter/path or unvalidated input |
| Logic / execution | Branch/function/module decisions and external actions expose per-operation results | Swallowed failures, shell reinterpretation, blind retries or last-result-wins behavior |
| Result / proof | Exit/exception/log evidence is correlated with independent target read-back | Process success or printed output treated as target success |
| Recovery / troubleshooting | First failed boundary is preserved, changed minimally and retested | Random edits, catch-all suppression or evidence destroyed before diagnosis |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5212