FIND YOUR NEXT FEW LINES

Results for “Inspecting the working tree”

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

175 snippets foundClear filters
Bash ScriptsLoops & decisions

Sum a range of integers

Use an arithmetic loop without launching external processes.

arithmetic✓ Tested
Bash ScriptsGetting Started

Test a function’s success status

Bash Scripts: Test a function’s success status with a small standalone Bash program.

Bash Scripts✓ Tested
Bash ScriptsText parsing & arithmetic

Test numeric divisibility with a remainder

Bash Scripts: The modulo operator computes an integer remainder.

Bash Scripts✓ Tested
GitRestoring & revising local work

Uncommit a local change and leave its edits unstaged

Git: A mixed reset resets the index while retaining working-file contents.

Git✓ Tested
GitRestoring & revising local work

Uncommit the latest local change while keeping it staged

Git: A soft reset moves the branch tip but preserves both index and working files.

Git✓ Tested
SQL ServerJSON & results

Update a JSON property

Create updated JSON text with JSON_MODIFY.

JSON_MODIFY✓ Tested
Bash ScriptsGetting Started

Use a counted Bash loop

Bash Scripts: Use a counted Bash loop with a small standalone Bash program.

Bash Scripts✓ Tested
Bash ScriptsVariables & text

Use a default value for an unset variable

Supply a fallback without changing the original variable.

parameter expansion✓ Tested
Bash ScriptsGetting Started

Use a fallback for an unset variable

Bash Scripts: Use a fallback for an unset variable with a small standalone Bash program.

Bash Scripts✓ Tested
Bash ScriptsFunction scope & composition

Use a function’s exit status as a boolean result

Bash Scripts: Return zero for success and test the function directly in a conditional.

Bash Scripts✓ Tested
Bash ScriptsFunction scope & composition

Use a recursive function for a bounded calculation

Bash Scripts: A recursive factorial demonstrates local variables and a clear base case.

Bash Scripts✓ Tested
Bash ScriptsParameter expansion

Use an alternate value only when a variable is nonempty

Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.

Bash Scripts✓ Tested