Lesson 155 of 1455
Bash and Shell With AI
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.
Builders · AI-Assisted Coding · ~18 min read
Everything Is a Stream
A command's stdout can be piped into the next command's stdin. That is the whole philosophy. Small tools, composed with `|`.
set -euo pipefail is the safety line. It makes scripts fail loudly instead of silently.
#!/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 }'A loop with variables
Arrays, quoted expansions, and curl's write-out format. The basics of a real ops script.
#!/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" doneThe 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.
End-of-lesson quiz
Check what stuck
6 questions · Score saves to your progress.
Lesson help
Questions are best handled with a grown-up here.
For this age range, Tendril keeps freeform AI chat paused until parent/guardian consent and child-safe moderation are fully verified. Use the quiz, notes, and related lessons below, or ask a parent, guardian, teacher, or librarian to work through the question with you.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Builders · 30 min
Python Loops & Conditionals — Let AI Draft, You Decide
If-statements and loops are where programs come alive. You'll write both kinds, then see where AI autocomplete helps and where it lies.
Builders · 25 min
What Does AI-Assisted Coding Even Mean?
AI-assisted coding is not magic and not cheating. It is a new way of working where a model drafts, you decide. Let's draw a map before we start building.
Builders · 30 min
Your First Copilot-Style Completion
Let's actually feel what autocomplete is like. Write a comment, pause, and watch a full function appear. Then learn what to do next.
