Script
Also: 腳本 · shell script · bash script · shell 腳本 · setup.sh
A file holding a sequence of commands run in order — the things you would otherwise type in a terminal, saved so they can be run again.
When you will meet it
AI install guides often say 'download this setup.sh and run it', and you will often tell an agent to 'write a script to handle these files'. If you do not know a script is just a list of commands, you will not dare open it — and then you cannot judge whether it is safe, even though you are about to be asked to run it.
An analogy
Like a laminated process card: wash, chop, fry, written down in order so anyone can follow it once and get the same result every time. A terminal session is improvised; a script is read aloud.
Minimal example
#!/usr/bin/env bash
set -e # 任何一步失敗就停下來,不要硬著往下做
echo "目前所在資料夾:$(pwd)"
python3 --version # 這一行若失敗,下面就不會執行
node --version 2>/dev/null || echo "沒裝 Node.js(有些工具不需要)"
echo "環境檢查完成"The #! on line one tells the system which program should read the file — bash here. Save it as check.sh and run it with bash check.sh; to run it as ./check.sh you must first chmod +x check.sh.
What people get wrong
- Treating 'script' and 'program' as two tiers of thing. The difference is mostly scale and intent: a script usually chains existing actions together and finishes, while a program usually runs for a long time and handles varied input. The line is genuinely blurry.
- Piping a downloaded script straight into bash without opening it first. That hands your machine's permissions, unread, to a stranger's file.
Related terms
Next
- Build Your First AI Workflow Without Writing Code12 minChinese only
- 五分鐘設置你的 LLM 開發環境15 minChinese only