Loading lesson…
The terminal is where real work happens. Pipes, variables, and loops in bash are a superpower — and AI is surprisingly good at shell one-liners.
A command's stdout can be piped into the next command's stdin. That is the whole philosophy. Small tools, composed with `|`.
#!/usr/bin/env bash
set -euo pipefail
# Find the 5 largest files in the current tree
find . -type f -printf "%s %p\n" 2>/dev/null \
| sort -rn \
| head -n 5 \
| awk '{ printf "%.1f MB\t%s\n", $1/1024/1024, $2 }'set -euo pipefail is the safety line. It makes scripts fail loudly instead of silently.#!/usr/bin/env bash
set -euo pipefail
ENVS=(dev staging prod)
for env in "${ENVS[@]}"; do
url="https://${env}.example.com/health"
code=$(curl -s -o /dev/null -w "%{http_code}" "$url")
echo "$env -> $code"
doneArrays, quoted expansions, and curl's write-out format. The basics of a real ops script.The big idea: small tools, piped together, with strict error handling and quoted variables. AI writes bash fluently — you just need to recognize the safety rules.
15 questions · take it digitally for instant feedback at tendril.neural-forge.io/learn/quiz/end-progx-bash-shell-builders
In bash, what does the pipe operator (|) do?
What is the purpose of the pipefail option in a bash pipeline?
Why should you quote a variable like "$var" instead of using $var unquoted in bash?
What happens when a command in the middle of a pipeline fails if pipefail is NOT enabled?
What does the shebang line at the top of a script specify?
What is the core philosophy behind composing tools with pipes in bash?
When might you intentionally use an unquoted variable in bash (without quotes around $var)?
What does it mean that 'everything is a stream' in the bash philosophy?
A user runs: for f in $files; do echo $f; done. If $files contains "report.txt summary.txt", how many times will the loop iterate?
What is a key safety rule when using AI-generated bash commands?
What is stdin in the context of bash pipelines?
What does strict error handling mean in bash pipelines?
Why is the pipe operator considered powerful for combining tools?
What should you do before running an AI-generated bash one-liner that modifies files?
In the command for f in *.txt; do something with "$f"; done, what is the purpose of the quotes around $f?