rootiest / bash-script-hygeine.md
0 лайк(-ов)
0 форк(-ов)
1 файл(-ов)
Последняя активность 1 day ago
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. |
Новее
Позже