Advanced

A config file as a layer under the words

A person types the same words every time. The file is the layer that holds them, and a layer is why the words still win when both are given.

What you will see

max words. Reported per name is what makes it visible.

About 1 min of reading

Try It

Prove the words win

1

Write the layers

printf 'max 20\n' > /tmp/f.txt; printf 'max 5\n' > /tmp/w.txt; tail -1 /tmp/w.txt

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

What it prints
max 5. The words are the last layer, which is the winner.
2

Read the file as pairs

wc -f -w < /tmp/f.txt

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

What it prints
2. Two fields is the same shape as the words.
3

Report the layer

printf 'name max layer words\n' | awk '{print $2, $4}'

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

What it prints
max words. Reported per name is what makes it visible.

Data Flow

Three layers to one value
1 The defaults are written
↓
2 The file is read as names and values
↓
3 The words are read last
↓
4 The layer used is reported per name
Why this works
Why the words always win

The words are the closest to the run. Closest winning is what makes a file never surprise a person.

The one thing never read from a file

A secret. A secret in a file that is read by a tool is a secret that a log can print.

Examples

The order is written

Default, file, words. Three layers, and three layers is an order a reader checks from the bottom.

The file is read as the same shape

Names and values. The same shape is what makes a file a set of words rather than a different language.

The layer used is reported

Reported per name. Reported is what makes a value that came from a file a value a reader knows about.

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.

← Subcommands as a tree with one leaf
Previous Lesson
Subcommands as a tree with one leaf
Next Lesson
A dry run as the same code with a different write
A dry run as the same code with a different write →