Advanced

Flags as a table with a short and a long name

A flag is a name with a shape. The shape is why one letter and one word are the same decision, and the same decision is why a person can type either.

What you will see

refuse q is switch. The row names the shape.

About 1 min of reading

Try It

Answer a combined word

1

Write the table

printf 'm max value\ns sort value\nq quiet switch\n' > /tmp/t.txt; wc -l < /tmp/t.txt

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

What it prints
3. Three rows is the table, which has both names.
2

Split a combined word

printf 'mq\n' | grep -o . | wc -l

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

What it prints
2. Two flags from one word is the claim.
3

Refuse a shape mismatch

printf 'q value\n' | awk '{print ($2=="value") ? "refuse q is switch" : "ok"}'

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

What it prints
refuse q is switch. The row names the shape.

Data Flow

A word to a flag row
1 The table is written with both names and a shape
↓
2 A word is looked up in the table
↓
3 A combined word is split into flags
↓
4 A shape that does not fit refuses with the row
Why this works
Why the long name is the one in the table

A long name is a name a reader writes down. A short name is a name a person types, and a typist is not a reader.

The failure at this step

A flag that takes a value and is given none. The row is the answer, and the row names the shape.

Examples

The table has both names

A short name and a long name per flag. A row is what a reader of the table reads.

A flag is a switch or a value

Two shapes, and two shapes is what makes a flag that takes a value refuse a flag that does not.

The short names are combined

Combined is one word. One word is a row that the table answers as several flags, and several flags is the claim.

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.

← Help as the tool answering about itself
Previous Lesson
Help as the tool answering about itself
Next Lesson
Subcommands as a tree with one leaf
Subcommands as a tree with one leaf →