Basic

Arguments as a written shape

Words in a row are words that can be in the wrong place. The shape is the reason a tool answers about a name rather than about a position.

What you will see

The same hash for both rows. Pairs make the order not matter.

About 1 min of reading

Try It

Refuse a word outside the list

1

Write the names

printf 'file\nmax\nsort\n' > /tmp/n.txt; wc -l < /tmp/n.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
3. Three names is the list a reader reads.
2

Attempt a wrong name

printf 'mrk\n' | grep -c -f -x /tmp/n.txt /dev/stdin | awk '{print ($1==0) ? "refuse names mrk" : "ok"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse names mrk. The refusal names the word.
3

Prove order does not matter

printf 'max 5 file a\nfile a max 5\n' | sort | md5sum | cut -c1-8

Before you run it, say out loud what it will print. Then open the answer.

What it prints
The same hash for both rows. Pairs make the order not matter.

Data Flow

A row of words to pairs
1 The row is split into words
↓
2 Each word is read as a name and a value
↓
3 The names are checked against the list
↓
4 A name outside the list refuses with the word
Why this works
Why a position is never the meaning

A position is a claim about a row. A row changes when a person adds a word, and a changed row is a different tool.

The one word that must be a name and never a value

The command. A command that is a value is a command that a reader cannot list.

Examples

Every word is a name and a value

A name and a value. A pair is what makes the order of the words not matter.

The names are listed

The tool says which names it takes. A list is what a reader of the help reads.

A name that is not taken is refused

The refusal names the word. A named word is a word that a person can fix without rereading the manual.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← What a command line tool is for
Previous Lesson
What a command line tool is for
Next Lesson
Parsing with a default that is written
Parsing with a default that is written →