The universal glue on every Linux box - with a few rules it becomes safe and reliable automation. This walkthrough covers the mental model and the configuration you will actually touch.
Bash is the shell present on virtually every Linux system. With strict mode and a little discipline it is perfect for small, reliable automation, wrappers and glue between tools.
The configuration that matters
A safe script skeleton with strict mode and a trap.
#!/usr/bin/env bash
set -Eeuo pipefail
trap 'echo "error on line $LINENO" >&2' ERR
main() {
local name="${1:?usage: deploy <name>}"
echo "deploying ${name}"
}
main "$@"Principles to hold onto
- Start every script with set -Eeuo pipefail and an ERR trap
- Quote all variable expansions; prefer [[ ]] over [ ]
- Run shellcheck and shfmt in CI
Everyday commands
shellcheck deploy.sh
shfmt -d -i 2 deploy.sh
bash -n deploy.sh # syntax check without runningWant senior help putting Bash & Shell Scripting to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.