FIND YOUR NEXT FEW LINES

Results for “working tree”

Small, practical examples. Search by task or narrow things down below.

174 snippets foundClear filters
Bash ScriptsDiagnostics & defensive scripting

Prevent a variable value from expanding as a filename pattern

Bash Scripts: Quote a variable to pass its literal contents even when matching filenames exist.

Bash Scripts✓ Tested
Bash ScriptsText parsing & arithmetic

Print text containing percent characters literally

Bash Scripts: Never use untrusted text as the printf format string.

Bash Scripts✓ Tested
GitCommits & history

Read a file from a commit

Inspect committed content without changing your working copy.

show✓ Tested
Bash ScriptsLoops & decisions

Read a file without losing its last line

Handle spaces, backslashes, and a final line without a newline.

read lines✓ Tested
Bash ScriptsGetting Started

Read a line without losing backslashes

Bash Scripts: Read a line without losing backslashes with a small standalone Bash program.

Bash Scripts✓ Tested
Bash ScriptsParameter expansion

Read a string’s character length

Bash Scripts: Bash parameter length counts characters under the current locale.

Bash Scripts✓ Tested
Bash ScriptsParameter expansion

Read a variable whose name is stored in another variable

Bash Scripts: Indirect expansion performs one extra variable-name lookup.

Bash Scripts✓ Tested
Bash ScriptsArray operations

Read an optional associative-array entry

Bash Scripts: Use a fallback expansion when a map key may not be present under nounset.

Bash Scripts✓ Tested
Bash ScriptsInput streams & redirection

Read complete lines into an array

Bash Scripts: Mapfile with -t removes each line terminator but preserves other whitespace.

Bash Scripts✓ Tested
PythonStructured data & serialization

Read elements from trusted XML

Python: Use ElementTree to inspect a small trusted XML document.

Python✓ Tested
Bash ScriptsText parsing & arithmetic

Read fields captured by a Bash regular expression

Bash Scripts: BASH_REMATCH contains the full match followed by capture groups after a successful regex test.

Bash Scripts✓ Tested
Bash ScriptsInput streams & redirection

Read from a dedicated file descriptor

Bash Scripts: An explicitly opened descriptor keeps the script’s ordinary standard input available.

Bash Scripts✓ Tested