Pcornel
Automation · Scripting

Parameters

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

Back to the Topic

Answer

Parameters are the explicit caller-to-script contract for values that influence scope and behavior. Reliable parameters have defined type/shape, requiredness, defaults, allowed values and clear precedence.

Remember

  • Parameter present ≠ parameter valid; syntax acceptance does not prove range, identity or target existence.
  • Default value ≠ safe value for every environment; defaults must be context-appropriate and visible.
  • Optional ≠ irrelevant; omitted parameters can materially alter scope through defaults or discovery.
  • Parameter accepted ≠ caller authorized; authorization is a separate control from input parsing.

First checks

  • <script> --help — usage
  • getopts / argparse / param() — parameter parsing
  • Required parameter checks — validation

Verify in this order

CLI args → parser → validated parameters

Where it usually breaks

Successful parameter binding proves only that caller input was mapped into the script contract; it does not prove the value is safe, authorized or references a valid target.

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

Parameters 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=5219

Confirmation

Confirm action

Continue?