Results for “Inspecting the working tree”
Small, practical examples. Search by task or narrow things down below.
Set an environment value for one child command
Bash Scripts: A command-prefix assignment is visible to that command without overwriting the shell’s current variable.
Bash Scripts✓ Tested
Set and clear a bit in a shell integer
Bash Scripts: Use shifts and bitwise operators for a small flag field.
Bash Scripts✓ Tested
Show the current directory
Print the absolute path of your current working directory before running commands that depend on relative paths.
directory✓ Tested
Skip selected iterations in a loop
Bash Scripts: Continue starts the next iteration without running the remaining loop body.
Bash Scripts✓ Tested
Split a line into named fields
Read a simple delimiter-separated line into variables.
read✓ Tested
Split a record while retaining its remainder
Bash Scripts: The final read variable receives the remainder of a delimited record.
Bash Scripts✓ Tested
Stop a child process created by the script
Bash Scripts: Send a signal only to the captured PID of the script’s own child and wait for it to exit.
Bash Scripts✓ Tested
Stop a search loop at the first match
Bash Scripts: Break exits the current loop as soon as the desired item is found.
Bash Scripts✓ Tested
Stop tracking a generated file while keeping it locally
Git: Removing a path from the index leaves its working copy intact when cached is specified.
Git✓ Tested
Store and iterate over an array
Bash Scripts: Store and iterate over an array with a small standalone Bash program.
Bash Scripts✓ Tested
Store text in a variable
Bash Scripts: Store text in a variable with a small standalone Bash program.
Bash Scripts✓ Tested
Substitute values into a multiline template
Bash Scripts: An unquoted heredoc delimiter enables parameter expansion in the template.
Bash Scripts✓ Tested