Bash Scripting

Bash scripting standards with safe quoting, parameter expansion, error handling, and command execution patterns. Use for any .sh file edits.

myFinTechPL Updated

File contents

Bash Scripting

Baseline

  • Use bash with strict mode unless documented.
  • Use local variables in functions.

Quoting & Expansion

  • Quote variables by default.
  • Use "$@" not $*.
  • Use ${10}+ for positional parameters above 9.

Command Execution

  • Treat bash -lc wrappers as string-command APIs.
  • Never join arguments with "$*".

Security

  • Validate inputs.
  • Avoid eval.
  • Minimize remote shell injection risk.

Reuse

  • Prefer lib/ helpers for logging, exec, fs, asserts.

ShellCheck

  • Prefer ShellCheck-clean code.
  • Document SC suppressions when required.

myFinTechPL/copilot-skills/tree/main/.copilot/skills/bash-scripting commit 98a5f38719

Frequently asked questions

npx skillmds@latest add myfintechpl/bash-scripting