Pcornel
Automation

Scripting

Cheat sheet · https://pcornel.dk/topic.php?topic=5212

Back to the Topic

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 lint
  • Invoke-ScriptAnalyzer -Path script.ps1 — PowerShell lint
  • ruff 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

BoundaryHealthy evidenceSuspicious evidence
Input / runtimeEffective inputs, runtime, working context and dependency versions are explicitHidden defaults, stale environment, wrong interpreter/path or unvalidated input
Logic / executionBranch/function/module decisions and external actions expose per-operation resultsSwallowed failures, shell reinterpretation, blind retries or last-result-wins behavior
Result / proofExit/exception/log evidence is correlated with independent target read-backProcess success or printed output treated as target success
Recovery / troubleshootingFirst failed boundary is preserved, changed minimally and retestedRandom 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

Confirmation

Confirm action

Continue?