A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
Command substitution captures stdout from another command and substitutes the resulting text into the surrounding command. `$(...)` is the preferred syntax because it nests cleanly and is easier to read than legacy backticks. Shell expansion is a pipeline of transformations, not a single “replace variables” step.
Globbing is different from command substitution. `*.log` is expanded against directory entries before the command starts. If no path matches under the default Bash setting, the pattern can remain literal. That behavior surprises scripts that expect a loop over zero files to simply do nothing.
Captures the current hostname into `host`. The useful habit here is to treat the command output as evidence about one system fact, not as a magical diagnosis.
Tool choice is situational. Start with the narrowest command that answers the question, then escalate to a heavier tool only when the first observation leaves a real gap.
Use command substitution for data you actually need, not for control flow that could be expressed more clearly with a direct command. Also remember that trailing newlines are removed from command-substitution output. That is convenient for most command results but matters when exact byte preservation is required.
Captures two output lines into a string, illustrating why line-oriented parsing needs care. Read the result in context: the same command can be correct yet insufficient if a permission boundary, alternate configuration, or different backend changes what it reports.
Shows a simple command substitution used for a scalar value. In a production workflow, save the raw result when the observation contributes to a finding. That keeps later analysis honest and makes troubleshooting reproducible.
A practitioner’s checkpoint: compare the observed behavior with the assumption your script is about to make. If the assumption is broader than the evidence, narrow the rule. If the evidence is incomplete, report the uncertainty instead of converting it into a confident finding.
Lab discipline: stay inside the declared course environment, prefer read-only checks for learning exercises, and preserve the original output of security tools before transforming it.
Finish the lesson once you have worked through the material. This awards ★ 35 XP.