← ELI5 中文
ELI5

What is
a script?

For people who have never written a program
No. 22Inside Computers & the InternetPart 10 of 20
1

In one sentence

Note

A script is a note written for a computer. It lists, in order, "do this first, then that", and the computer works through it line by line.

Like the note you leave your family before heading out: "turn off the gas, lock the door, leave the keys on the shoe rack". There is only one difference: whoever follows it is a computer, not a person.

2

How is it different
from doing it by hand?

BEFORE
Someone has to click
through it every time
A dozen steps, and none can go wrong. You do it again the second time, and by the third time the person has forgotten.
WITH A SCRIPT
Write those dozen steps
on a note and save it
From then on, call it once and it runs by itself. Run it a hundred times and you get the same result a hundred times.

Put simply: figure a thing out once, and never think about it again.

3

Where does
it come from?

1. Spell it outHow many steps are there, and in what order?
2. Write the noteOne step per line, saved on the computer so it never gets lost
3. Call it any timeOr set a time and it starts by itself
4. Same every timeIt doesn't get tired, forget, or have moods
4

What is it
used for?

Tidying a pileRename and sort hundreds of files in one go
Doing it on scheduleRuns at a fixed time each day, so you don't have to remember
Making a backupImportant things are copied automatically, so they can't be lost
Building a reportScattered numbers get gathered into something readable

None of these four is hard. What is hard is having someone redo it by hand every single time.

5

One thing
it can't do

It can't improvise Anything not on the note, it won't do. If the note is wrong, it will faithfully carry out the wrong step a hundred times.
So it isn't smart. It is obedient. That is exactly where its value lies. People get tired, bored and moody. It doesn't. But "how should this be done" is a call that always has to be yours.
"Would I ever use one?"
Check a task against two rules:
You did it three or more times this month, and
the steps were the same each time.

If both are true, it should become a note. You only have to spell it out once.
UP NEXT

What Is Tailscale?

A key card for all your machines: wherever they are, they act like they're in one room. What it saves you, how it works, and what it isn't.

No. 23 · 3 minKeep going →
← Back to ELI5