The original script stored commands in strings and executed them with eval. That works, but it also turns quoting mistakes into a small security workshop. Shell commands can be called directly.
1 |
|
set -Eeuo pipefail makes the script stop on failed commands, unset variables, and failed commands inside pipelines. printf is safer and more predictable than nested quoted echo commands.
Command chaining
1 | A; B # Run B regardless of whether A succeeds. |
For deployments, && or strict mode is usually the sane choice. Publishing half a site because the build failed is technically automation, just not the useful kind.