6. Basic Scripting¶
A script automates a repeatable task — anything you'd otherwise type by hand, over and over, every single time. You've already written real scripts in this course, in Unit 3 (Python Basics) — this lesson just names the broader landscape around that.
Script types, by platform¶
| Extension | Language | Typical use |
|---|---|---|
.bat |
Windows batch | Old but still common for simple automation |
.ps1 |
PowerShell | Modern Windows automation, far more capable than batch |
.sh |
bash | Linux/macOS automation |
.py |
Python | Cross-platform, the language this whole course builds toward |
The same concepts everywhere¶
Every scripting language uses the same core ideas you already learned in Unit 3: variables, loops, conditionals, and functions. The syntax differs; the thinking doesn't. A PowerShell if statement and a Python if statement are the same idea wearing different clothes.
Why scripting matters for a technician¶
Every deploy for this course's own wiki has been a script-driven process: a bash script backs up the server, builds the site, snapshots the container, and pushes the update — the same handful of steps, run reliably every single time instead of being retyped by hand and risking a skipped step.
Try it
Name one repetitive task from any earlier module in this course that a short script could automate, and which language from the table above you'd pick for it.
Tip
A script that's run many times is worth the extra time to make reliable — a script you'll genuinely only ever run once is often not worth automating at all.
Play it
Open the Operational Procedures Lab and use the Scripting tab.