blob: faa2022490b96e0e49a6d32e5fafc289477cd85e [file] [view]
---
trigger: glob
description: Shell / Bash scripting style and portability rules
globs: "*.sh"
---
# Shell Scripting Rules
* Use `elif` instead of nesting `if` inside an `else` block.
* When reading file paths from a manifest or list file, iterate line-by-line
with `while IFS= read -r file; do ...; done < "$manifest"`. Do not use
unquoted command substitution (`$(cat "$manifest")`) or suppress ShellCheck
`SC2046` assuming paths lack spaces.
* Do not create companion `.sh` forwarders that merely pass `"$@"` to another
executable or script.