Question 150
In a Linux Essentials study lab, the student observes: A user runs a command prefixed with a leading space and assumes shell expansion will not occur because the text looks indented. What preventive habit belongs in the runbook?
Explanation
Correct Answer
Teach command parsing rather than relying on visual indentation as a safety control. This practice reduces recurrence of the same problem. Technical reason: Bash ignores irrelevant leading blanks while continuing standard tokenization and parameter expansion. A controlled repeat test should show: A harmless echo $HOME command with leading blanks still prints the expanded home path.
Incorrect Answers
“Teach single and double quote differences with harmless variable-expansion fixtures” is a sensible check for: Teach single and double quote differences with harmless variable-expansion fixtures. It is not the prevention measure for the current dependency: Teach command parsing rather than relying on visual indentation as a safety control. The closer guardrail is “Teach command parsing rather than relying on visual indentation as a safety control”.
The alternate safeguard protects a separate dependency: Distinguish deliberate literal patterns from shell-expanded wildcard arguments. For this failure the continuing exposure is: Teach command parsing rather than relying on visual indentation as a safety control. Maintain “Teach command parsing rather than relying on visual indentation as a safety control” instead.
This safeguard maintains a different technical control: Lint simple shell assignments and use safe quoted expansions. The recurring risk here is governed by: Teach command parsing rather than relying on visual indentation as a safety control. The relevant review is “Teach command parsing rather than relying on visual indentation as a safety control”.