Last active 1 day ago

Revision b2d0f9abbdb2a8fea630302aa76382dad75d388c

bash-script-hygeine.md Raw

Bash Scripting Basic Hygiene Checklist

Task Recommendation Why?
The Shebang #!/usr/bin/env bash Maximum portability across different Unix-like systems.
Error Handling set -euo pipefail Ensures the script stops at the first sign of trouble.
Quoting "$VARIABLE" Prevents word splitting and globbing (essential for paths).
Variable Style local_var="value" Lowercase prevents overwriting system-wide environment variables.
Boilerplate readonly CONSTANT Prevents accidental modification of fixed values.
Extensions .sh or none Helps with syntax highlighting and identifying file types.
Permissions chmod +x Use this tool to change permissions to make the script executable.